Revision: 102
http://www.exim.org/viewvc/pcre2?view=rev&revision=102
Author: ph10
Date: 2014-10-10 17:16:44 +0100 (Fri, 10 Oct 2014)
Log Message:
-----------
Fix "first code unit" bug.
Modified Paths:
--------------
code/trunk/src/pcre2_compile.c
code/trunk/testdata/testinput1
code/trunk/testdata/testinput2
code/trunk/testdata/testoutput1
code/trunk/testdata/testoutput2
Modified: code/trunk/src/pcre2_compile.c
===================================================================
--- code/trunk/src/pcre2_compile.c 2014-10-10 11:55:28 UTC (rev 101)
+++ code/trunk/src/pcre2_compile.c 2014-10-10 16:16:44 UTC (rev 102)
@@ -6219,7 +6219,7 @@
than one can replicate it as reqcu if necessary. If the subpattern has
no firstcu, set "none" for the whole branch. In both cases, a zero
repeat forces firstcu to "none". */
-
+
if (firstcuflags == REQ_UNSET && subfirstcuflags != REQ_UNSET)
{
if (subfirstcuflags >= 0)
@@ -6750,15 +6750,16 @@
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. */
- if (firstcuflags >= 0 &&
- (firstcuflags != branchfirstcuflags ||
- firstcu != branchfirstcu))
+ if (firstcuflags != branchfirstcuflags || firstcu != branchfirstcu)
{
- if (reqcuflags < 0)
+ if (firstcuflags >= 0)
{
- reqcu = firstcu;
- reqcuflags = firstcuflags;
- }
+ if (reqcuflags < 0)
+ {
+ reqcu = firstcu;
+ reqcuflags = firstcuflags;
+ }
+ }
firstcuflags = REQ_NONE;
}
Modified: code/trunk/testdata/testinput1
===================================================================
(Binary files differ)
Modified: code/trunk/testdata/testinput2
===================================================================
--- code/trunk/testdata/testinput2 2014-10-10 11:55:28 UTC (rev 101)
+++ code/trunk/testdata/testinput2 2014-10-10 16:16:44 UTC (rev 102)
@@ -3995,4 +3995,12 @@
/abcd/I,no_start_optimize
+/(|ab)*?d/I
+ abd
+ xyd
+
+/(|ab)*?d/I,no_start_optimize
+ abd
+ xyd
+
# End of testinput2
Modified: code/trunk/testdata/testoutput1
===================================================================
(Binary files differ)
Modified: code/trunk/testdata/testoutput2
===================================================================
--- code/trunk/testdata/testoutput2 2014-10-10 11:55:28 UTC (rev 101)
+++ code/trunk/testdata/testoutput2 2014-10-10 16:16:44 UTC (rev 102)
@@ -13554,4 +13554,26 @@
Options: no_start_optimize
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