Fix non-recognition of anchoring when preceded by (*MARK) etc.

This commit is contained in:
ph10 2018-11-27 16:00:58 +00:00
parent 78a3e55220
commit 72542e3c19
4 changed files with 39 additions and 4 deletions

View File

@ -85,6 +85,9 @@ via a string callout.
21. Improve MAP_JIT flag usage on MacOS. Patch by Rich Siegel.
22. If a pattern started with (*MARK), (*COMMIT), (*PRUNE), (*SKIP), or (*THEN)
followed by ^ it was not recognized as anchored.
Version 10.32 10-September-2018
-------------------------------

View File

@ -4615,6 +4615,14 @@ for (;;)
code += GET(code, 1) + 1 + LINK_SIZE;
break;
case OP_MARK:
case OP_COMMIT_ARG:
case OP_PRUNE_ARG:
case OP_SKIP_ARG:
case OP_THEN_ARG:
code += code[1] + PRIV(OP_lengths)[*code];
break;
default:
return code;
}

6
testdata/testinput2 vendored
View File

@ -5553,4 +5553,10 @@ a)"xI
/foobar/g
the foobar thing foobar again\=copy_matched_subject
/(*:XX)^abc/I
/(*COMMIT:XX)^abc/I
/(*ACCEPT:XX)^abc/I
# End of testinput2

18
testdata/testoutput2 vendored
View File

@ -16875,6 +16875,24 @@ Failed: error 128 at offset 14: assertion expected after (?( or (?(?C)
0: foobar
0: foobar
/(*:XX)^abc/I
Capturing subpattern count = 0
Compile options: <none>
Overall options: anchored
First code unit = 'a'
Subject length lower bound = 3
/(*COMMIT:XX)^abc/I
Capturing subpattern count = 0
Compile options: <none>
Overall options: anchored
First code unit = 'a'
Subject length lower bound = 3
/(*ACCEPT:XX)^abc/I
Capturing subpattern count = 0
Subject length lower bound = 0
# End of testinput2
Error -70: PCRE2_ERROR_BADDATA (unknown error number)
Error -62: bad serialized data