Fix "first code unit" bug.

This commit is contained in:
Philip.Hazel 2014-10-10 16:16:44 +00:00
parent 62d728bb0b
commit 623b497851
5 changed files with 50 additions and 8 deletions

View File

@ -6750,15 +6750,16 @@ for (;;)
we have to abandon the firstcu for the regex, but if there was we have to abandon the firstcu for the regex, but if there was
previously no reqcu, it takes on the value of the old firstcu. */ previously no reqcu, it takes on the value of the old firstcu. */
if (firstcuflags >= 0 && if (firstcuflags != branchfirstcuflags || firstcu != branchfirstcu)
(firstcuflags != branchfirstcuflags || {
firstcu != branchfirstcu)) if (firstcuflags >= 0)
{ {
if (reqcuflags < 0) if (reqcuflags < 0)
{ {
reqcu = firstcu; reqcu = firstcu;
reqcuflags = firstcuflags; reqcuflags = firstcuflags;
} }
}
firstcuflags = REQ_NONE; firstcuflags = REQ_NONE;
} }

4
testdata/testinput1 vendored
View File

@ -5698,4 +5698,8 @@ name)/mark
A8B A8B
A9B A9B
/(|ab)*?d/
abd
xyd
# End of testinput1 # End of testinput1

8
testdata/testinput2 vendored
View File

@ -3995,4 +3995,12 @@ a random value. /Ix
/abcd/I,no_start_optimize /abcd/I,no_start_optimize
/(|ab)*?d/I
abd
xyd
/(|ab)*?d/I,no_start_optimize
abd
xyd
# End of testinput2 # End of testinput2

View File

@ -9396,4 +9396,11 @@ No match
A9B A9B
0: A9B 0: A9B
/(|ab)*?d/
abd
0: abd
1: ab
xyd
0: d
# End of testinput1 # End of testinput1

22
testdata/testoutput2 vendored
View File

@ -13554,4 +13554,26 @@ Capturing subpattern count = 0
Options: no_start_optimize Options: no_start_optimize
Subject length lower bound = 0 Subject length lower bound = 0
/(|ab)*?d/I
Capturing subpattern count = 1
Starting code units: a d
Last code unit = 'd'
Subject length lower bound = 1
abd
0: abd
1: ab
xyd
0: d
/(|ab)*?d/I,no_start_optimize
Capturing subpattern count = 1
Options: no_start_optimize
Last code unit = 'd'
Subject length lower bound = 0
abd
0: abd
1: ab
xyd
0: d
# End of testinput2 # End of testinput2