Giter Site home page Giter Site logo

Comments (4)

k-takata avatar k-takata commented on June 6, 2024

It seems to be caused by this #ifdef block:

Onigmo/regexec.c

Line 4176 in 754f936

#ifdef USE_MATCH_RANGE_MUST_BE_INSIDE_OF_SPECIFIED_RANGE

I don't know why this block is needed. I'll look into it more closely.

BTW, I think the expected result is 2-3.

from onigmo.

k-takata avatar k-takata commented on June 6, 2024

Hmm, the #ifdef block was added with Oniguruma 5.7.0.

Copied from the HISTORY:

2007/04/27: Version 5.7.0

2007/04/20: [spec] add config USE_MATCH_RANGE_IS_COMPLETE_RANGE.
2007/04/20: [impl] refactoring in match_at().

Note: USE_MATCH_RANGE_IS_COMPLETE_RANGE was changed to USE_MATCH_RANGE_MUST_BE_INSIDE_OF_SPECIFIED_RANGE with Oniguruma 5.9.0.

from onigmo.

sorbits avatar sorbits commented on June 6, 2024

Thanks for looking into this.

Does this mean that defining USE_MATCH_RANGE_MUST_BE_INSIDE_OF_SPECIFIED_RANGE should return a match of 2-3?

I tried to define it in regexec.c:33 but got unchanged result.

from onigmo.

k-takata avatar k-takata commented on June 6, 2024

Does this mean that defining USE_MATCH_RANGE_MUST_BE_INSIDE_OF_SPECIFIED_RANGE should return a match of 2-3?

Yes, I think so. But currently the result is 3-4 as you reported.

After applying the following patch, the result becomes 2-3 when USE_MATCH_RANGE_MUST_BE_INSIDE_OF_SPECIFIED_RANGE is defined.
(If it is not defined, the result becomes 3-6.)

--- a/regexec.c
+++ b/regexec.c
@@ -4173,11 +4173,6 @@ onig_search_gpos(regex_t* reg, const UChar* str, const UChar* end,
     }
   }
   else {  /* backward search */
-#ifdef USE_MATCH_RANGE_MUST_BE_INSIDE_OF_SPECIFIED_RANGE
-    if (orig_start < end)
-      orig_start += enclen(reg->enc, orig_start); /* is upper range */
-#endif
-
     if (reg->optimize != ONIG_OPTIMIZE_NONE) {
       UChar *low, *high, *adjrange, *sch_start;

I'm concerning about side effects caused by this patch. More tests are needed.

from onigmo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.