Make pcre2_match() return (*MARK) names from successful conditional assertions,
as Perl and the JIT do.
This commit is contained in:
parent
1f6b9097f4
commit
49f174ef78
|
@ -35,6 +35,9 @@ minimum is potentially useful.
|
|||
|
||||
* When no minimum length is set by the normal scan, but a first and/or last
|
||||
code unit is recorded, set the minimum to 1 or 2 as appropriate.
|
||||
|
||||
10. A (*MARK) value inside a successful condition was not being returned by the
|
||||
interpretive matcher (it was returned by JIT). This bug has been mended.
|
||||
|
||||
|
||||
Version 10.33 16-April-2019
|
||||
|
|
|
@ -5472,15 +5472,16 @@ fprintf(stderr, "++ op=%d\n", *Fecode);
|
|||
|
||||
/* If we are at the end of an assertion that is a condition, return a
|
||||
match, discarding any intermediate backtracking points. Copy back the
|
||||
captures into the frame before N so that they are set on return. Doing
|
||||
this for all assertions, both positive and negative, seems to match what
|
||||
Perl does. */
|
||||
mark setting and the captures into the frame before N so that they are
|
||||
set on return. Doing this for all assertions, both positive and negative,
|
||||
seems to match what Perl does. */
|
||||
|
||||
if (GF_IDMASK(N->group_frame_type) == GF_CONDASSERT)
|
||||
{
|
||||
memcpy((char *)P + offsetof(heapframe, ovector), Fovector,
|
||||
Foffset_top * sizeof(PCRE2_SIZE));
|
||||
P->offset_top = Foffset_top;
|
||||
P->mark = Fmark;
|
||||
Fback_frame = (char *)F - (char *)P;
|
||||
RRETURN(MATCH_MATCH);
|
||||
}
|
||||
|
|
|
@ -6343,4 +6343,12 @@ ef) x/x,mark
|
|||
/(?&word)* \. (?<word> \w+ )/xi
|
||||
pokus.hokus
|
||||
|
||||
/a(?(?=(*:2)b).)/mark
|
||||
abc
|
||||
acb
|
||||
|
||||
/a(?(?!(*:2)b).)/mark
|
||||
acb
|
||||
abc
|
||||
|
||||
# End of testinput1
|
||||
|
|
|
@ -10049,4 +10049,18 @@ No match
|
|||
0: pokus.hokus
|
||||
1: hokus
|
||||
|
||||
/a(?(?=(*:2)b).)/mark
|
||||
abc
|
||||
0: ab
|
||||
MK: 2
|
||||
acb
|
||||
0: a
|
||||
|
||||
/a(?(?!(*:2)b).)/mark
|
||||
acb
|
||||
0: ac
|
||||
abc
|
||||
0: a
|
||||
MK: 2
|
||||
|
||||
# End of testinput1
|
||||
|
|
Loading…
Reference in New Issue