Fix \Q\E quantification bug.
This commit is contained in:
parent
a98121a212
commit
f77339a3ca
|
@ -218,6 +218,10 @@ followed by a caseful back reference, could lose the caselessness of the first
|
|||
repeated back reference (example: /(Z)(a)\2{1,2}?(?-i)\1X/i should match ZaAAZX
|
||||
but didn't).
|
||||
|
||||
35. If \Q was preceded by a quantified item, and the following \E was followed
|
||||
by '?' or '+', and there was at least one literal character between them, an
|
||||
internal error "unexpected repeat" occurred (example: /.+\QX\E+/).
|
||||
|
||||
|
||||
Version 10.22 29-July-2016
|
||||
--------------------------
|
||||
|
|
|
@ -2327,6 +2327,7 @@ while (ptr < ptrend)
|
|||
parsed_pattern = manage_callouts(thisptr, &previous_callout, options,
|
||||
parsed_pattern, cb);
|
||||
PARSED_LITERAL(c, parsed_pattern);
|
||||
meta_quantifier = 0;
|
||||
}
|
||||
continue; /* Next character */
|
||||
}
|
||||
|
@ -2405,10 +2406,10 @@ while (ptr < ptrend)
|
|||
continue; /* Next character in pattern */
|
||||
}
|
||||
|
||||
/* At the point we must process everything that must not change the
|
||||
qualification state. This is mainly comments, but we handle \Q and \E here as
|
||||
well, so that an item such as A\Q\E+ is treated as A+, as in Perl. An
|
||||
isolated \E is ignored. */
|
||||
/* Not a verb name character. At this point we must process everything that
|
||||
must not change the quantification state. This is mainly comments, but we
|
||||
handle \Q and \E here as well, so that an item such as A\Q\E+ is treated as
|
||||
A+, as in Perl. An isolated \E is ignored. */
|
||||
|
||||
if (c == CHAR_BACKSLASH && ptr < ptrend)
|
||||
{
|
||||
|
|
|
@ -4931,4 +4931,8 @@ a)"xI
|
|||
//replace=0
|
||||
\=offset=7
|
||||
|
||||
".+\QX\E+"B,no_auto_possess
|
||||
|
||||
".+\QX\E+"B,auto_callout,no_auto_possess
|
||||
|
||||
# End of testinput2
|
||||
|
|
|
@ -15386,6 +15386,27 @@ Failed: error -57 at offset 2 in replacement: bad escape sequence in replacement
|
|||
\=offset=7
|
||||
Failed: error -33: bad offset value
|
||||
|
||||
".+\QX\E+"B,no_auto_possess
|
||||
------------------------------------------------------------------
|
||||
Bra
|
||||
Any+
|
||||
X+
|
||||
Ket
|
||||
End
|
||||
------------------------------------------------------------------
|
||||
|
||||
".+\QX\E+"B,auto_callout,no_auto_possess
|
||||
------------------------------------------------------------------
|
||||
Bra
|
||||
Callout 255 0 4
|
||||
Any+
|
||||
Callout 255 4 4
|
||||
X+
|
||||
Callout 255 8 0
|
||||
Ket
|
||||
End
|
||||
------------------------------------------------------------------
|
||||
|
||||
# End of testinput2
|
||||
Error -63: PCRE2_ERROR_BADDATA (unknown error number)
|
||||
Error -62: bad serialized data
|
||||
|
|
Loading…
Reference in New Issue