Fix partial matching bug in pcre2_dfa_match().
This commit is contained in:
parent
434e3f7468
commit
c0d0ee5365
|
@ -79,6 +79,10 @@ existing "allusedtext" modifier and, as for complete matches, this facility is
|
|||
available only for non-JIT matching, because JIT does not maintain the first
|
||||
and last consulted characters.
|
||||
|
||||
15. DFA matching (using pcre2_dfa_match()) was not recognising a partial match
|
||||
if the end of the subject was encountered in a lookahead (conditional or
|
||||
otherwise), an atomic group, or a recursion.
|
||||
|
||||
|
||||
Version 10.33 16-April-2019
|
||||
---------------------------
|
||||
|
|
|
@ -3152,8 +3152,8 @@ for (;;)
|
|||
|
||||
/* We have finished the processing at the current subject character. If no
|
||||
new states have been set for the next character, we have found all the
|
||||
matches that we are going to find. If we are at the top level and partial
|
||||
matching has been requested, check for appropriate conditions.
|
||||
matches that we are going to find. If partial matching has been requested,
|
||||
check for appropriate conditions.
|
||||
|
||||
The "forced_ fail" variable counts the number of (*F) encountered for the
|
||||
character. If it is equal to the original active_count (saved in
|
||||
|
@ -3165,8 +3165,7 @@ for (;;)
|
|||
|
||||
if (new_count <= 0)
|
||||
{
|
||||
if (rlevel == 1 && /* Top level, and */
|
||||
could_continue && /* Some could go on, and */
|
||||
if (could_continue && /* Some could go on, and */
|
||||
forced_fail != workspace[1] && /* Not all forced fail & */
|
||||
( /* either... */
|
||||
(mb->moptions & PCRE2_PARTIAL_HARD) != 0 /* Hard partial */
|
||||
|
@ -3175,8 +3174,8 @@ for (;;)
|
|||
match_count < 0) /* no matches */
|
||||
) && /* And... */
|
||||
(
|
||||
partial_newline || /* Either partial NL */
|
||||
( /* or ... */
|
||||
partial_newline || /* Either partial NL */
|
||||
( /* or ... */
|
||||
ptr >= end_subject && /* End of subject and */
|
||||
ptr > mb->start_used_ptr) /* Inspected non-empty string */
|
||||
)
|
||||
|
|
|
@ -4972,4 +4972,26 @@
|
|||
\= Expect no match
|
||||
0
|
||||
|
||||
/(?<=pqr)abc(?=xyz)/
|
||||
123pqrabcxy\=ps,allusedtext
|
||||
123pqrabcxyz\=ps,allusedtext
|
||||
|
||||
/(?>a+b)/
|
||||
aaaa\=ps
|
||||
aaaab\=ps
|
||||
|
||||
/(abc)(?1)/
|
||||
abca\=ps
|
||||
abcabc\=ps
|
||||
|
||||
/(?(?=abc).*|Z)/
|
||||
ab\=ps
|
||||
abcxyz\=ps
|
||||
|
||||
/(abc)++x/
|
||||
abcab\=ps
|
||||
abc\=ps
|
||||
ab\=ps
|
||||
abcx
|
||||
|
||||
# End of testinput6
|
||||
|
|
|
@ -7809,4 +7809,40 @@ No match
|
|||
0
|
||||
No match
|
||||
|
||||
/(?<=pqr)abc(?=xyz)/
|
||||
123pqrabcxy\=ps,allusedtext
|
||||
Partial match: pqrabcxy
|
||||
<<<
|
||||
123pqrabcxyz\=ps,allusedtext
|
||||
0: pqrabcxyz
|
||||
<<< >>>
|
||||
|
||||
/(?>a+b)/
|
||||
aaaa\=ps
|
||||
Partial match: aaaa
|
||||
aaaab\=ps
|
||||
0: aaaab
|
||||
|
||||
/(abc)(?1)/
|
||||
abca\=ps
|
||||
Partial match: abca
|
||||
abcabc\=ps
|
||||
0: abcabc
|
||||
|
||||
/(?(?=abc).*|Z)/
|
||||
ab\=ps
|
||||
Partial match: ab
|
||||
abcxyz\=ps
|
||||
0: abcxyz
|
||||
|
||||
/(abc)++x/
|
||||
abcab\=ps
|
||||
Partial match: abcab
|
||||
abc\=ps
|
||||
Partial match: abc
|
||||
ab\=ps
|
||||
Partial match: ab
|
||||
abcx
|
||||
0: abcx
|
||||
|
||||
# End of testinput6
|
||||
|
|
Loading…
Reference in New Issue