Fix dynamic options changing bug.
This commit is contained in:
parent
c722bf2399
commit
9332d4be69
|
@ -141,6 +141,13 @@ Now, when Unicode support is compiled, PCRE2_EXTENDED also discards U+0085,
|
|||
U+200E, U+200F, U+2028, and U+2029, which are additional characters defined by
|
||||
Unicode as "Pattern White Space". This makes PCRE2 compatible with Perl.
|
||||
|
||||
32. In certain circumstances, option settings within patterns were not being
|
||||
correctly processed. For example, the pattern /((?i)A)(?m)B/ incorrectly
|
||||
matched "ab". (The (?m) setting lost the fact that (?i) should be reset at the
|
||||
end of its group during the parse process, but without another setting such as
|
||||
(?m) the compile phase got it right.) This bug was introduced by the
|
||||
refactoring in release 10.23.
|
||||
|
||||
|
||||
Version 10.31 12-February-2018
|
||||
------------------------------
|
||||
|
|
|
@ -2284,11 +2284,14 @@ typedef struct nest_save {
|
|||
#define NSF_RESET 0x0001u
|
||||
#define NSF_CONDASSERT 0x0002u
|
||||
|
||||
/* Of the options that are changeable within the pattern, these are tracked
|
||||
during parsing. The rest are used from META_OPTIONS items when compiling. */
|
||||
/* Options that are changeable within the pattern must be tracked during
|
||||
parsing. Some (e.g. PCRE2_EXTENDED) are implemented entirely during parsing,
|
||||
but all must be tracked so that META_OPTIONS items set the correct values for
|
||||
the main compiling phase. */
|
||||
|
||||
#define PARSE_TRACKED_OPTIONS \
|
||||
(PCRE2_DUPNAMES|PCRE2_EXTENDED|PCRE2_EXTENDED_MORE|PCRE2_NO_AUTO_CAPTURE)
|
||||
#define PARSE_TRACKED_OPTIONS (PCRE2_CASELESS|PCRE2_DOTALL|PCRE2_DUPNAMES| \
|
||||
PCRE2_EXTENDED|PCRE2_EXTENDED_MORE|PCRE2_MULTILINE|PCRE2_NO_AUTO_CAPTURE| \
|
||||
PCRE2_UNGREEDY)
|
||||
|
||||
/* States used for analyzing ranges in character classes. The two OK values
|
||||
must be last. */
|
||||
|
@ -3590,6 +3593,8 @@ while (ptr < ptrend)
|
|||
else
|
||||
{
|
||||
BOOL hyphenok = TRUE;
|
||||
uint32_t oldoptions = options;
|
||||
|
||||
top_nest->reset_group = 0;
|
||||
top_nest->max_group = 0;
|
||||
set = unset = 0;
|
||||
|
@ -3677,10 +3682,9 @@ while (ptr < ptrend)
|
|||
}
|
||||
else *parsed_pattern++ = META_NOCAPTURE;
|
||||
|
||||
/* If nothing changed, no need to record. The check of hyphenok catches
|
||||
the (?^) case. */
|
||||
/* If nothing changed, no need to record. */
|
||||
|
||||
if (set != 0 || unset != 0 || !hyphenok)
|
||||
if (options != oldoptions)
|
||||
{
|
||||
*parsed_pattern++ = META_OPTIONS;
|
||||
*parsed_pattern++ = options;
|
||||
|
|
|
@ -2184,6 +2184,11 @@
|
|||
Blah blah
|
||||
blaH blah
|
||||
|
||||
/((?i)blah)\s+(?m)A(?i:\1)/
|
||||
blah ABLAH
|
||||
\= Expect no match
|
||||
blah aBLAH
|
||||
|
||||
/(?>a*)*/
|
||||
a
|
||||
aa
|
||||
|
|
|
@ -3346,6 +3346,14 @@ No match
|
|||
0: blaH blah
|
||||
1: blaH
|
||||
|
||||
/((?i)blah)\s+(?m)A(?i:\1)/
|
||||
blah ABLAH
|
||||
0: blah ABLAH
|
||||
1: blah
|
||||
\= Expect no match
|
||||
blah aBLAH
|
||||
No match
|
||||
|
||||
/(?>a*)*/
|
||||
a
|
||||
0: a
|
||||
|
|
Loading…
Reference in New Issue