Revision: 937
http://vcs.pcre.org/viewvc?view=rev&revision=937
Author: ph10
Date: 2012-02-26 15:58:56 +0000 (Sun, 26 Feb 2012)
Log Message:
-----------
Confine (*COMMIT) inside positive assertions, as documented.
Modified Paths:
--------------
code/trunk/ChangeLog
code/trunk/pcre_exec.c
code/trunk/testdata/testinput1
code/trunk/testdata/testinput2
code/trunk/testdata/testoutput1
code/trunk/testdata/testoutput2
Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog 2012-02-25 17:02:23 UTC (rev 936)
+++ code/trunk/ChangeLog 2012-02-26 15:58:56 UTC (rev 937)
@@ -55,9 +55,12 @@
logical recursion happens, frames are retained on a chain and re-used where
possible. This sometimes gives as much as 30% improvement.
-13. (*COMMIT) is now correctly confined to within a recursive subpattern call.
+13. As documented, (*COMMIT) is now confined to within a recursive subpattern
+ call.
-14. It is now possible to link pcretest with libedit as an alternative to
+14. As documented, (*COMMIT) is now confined to within a positive assertion.
+
+15. It is now possible to link pcretest with libedit as an alternative to
libreadline.
Modified: code/trunk/pcre_exec.c
===================================================================
--- code/trunk/pcre_exec.c 2012-02-25 17:02:23 UTC (rev 936)
+++ code/trunk/pcre_exec.c 2012-02-26 15:58:56 UTC (rev 937)
@@ -1576,10 +1576,12 @@
break;
}
- /* PCRE does not allow THEN to escape beyond an assertion; it is treated
- as NOMATCH. */
+ /* PCRE does not allow THEN or COMMIT to escape beyond an assertion; it
+ is treated as NOMATCH. */
- if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN) RRETURN(rrc);
+ if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN &&
+ rrc != MATCH_COMMIT) RRETURN(rrc);
+
ecode += GET(ecode, 1);
md->mark = save_mark;
}
Modified: code/trunk/testdata/testinput1
===================================================================
--- code/trunk/testdata/testinput1 2012-02-25 17:02:23 UTC (rev 936)
+++ code/trunk/testdata/testinput1 2012-02-26 15:58:56 UTC (rev 937)
@@ -5253,4 +5253,10 @@
/(a(*COMMIT)b){0}a(?1)|aac/
aac
+/(?!a(*COMMIT)b)ac|cd/
+ ac
+
+/((?=a(*COMMIT)b)ab|ac){0}(?:(?1)|a(c))/
+ ac
+
/-- End of testinput1 --/
Modified: code/trunk/testdata/testinput2
===================================================================
--- code/trunk/testdata/testinput2 2012-02-25 17:02:23 UTC (rev 936)
+++ code/trunk/testdata/testinput2 2012-02-26 15:58:56 UTC (rev 937)
@@ -3733,4 +3733,10 @@
\r\r\r\P
\r\r\r\P\P
+/-- This one is here because Perl does not match: it seems to allow the COMMIT
+to escape from the assertion. --/
+
+/(?=a(*COMMIT)b|ac)ac|ac/
+ ac
+
/-- End of testinput2 --/
Modified: code/trunk/testdata/testoutput1
===================================================================
--- code/trunk/testdata/testoutput1 2012-02-25 17:02:23 UTC (rev 936)
+++ code/trunk/testdata/testoutput1 2012-02-26 15:58:56 UTC (rev 937)
@@ -8719,4 +8719,12 @@
aac
0: aac
+/(?!a(*COMMIT)b)ac|cd/
+ ac
+ 0: ac
+
+/((?=a(*COMMIT)b)ab|ac){0}(?:(?1)|a(c))/
+ ac
+ 0: ac
+
/-- End of testinput1 --/
Modified: code/trunk/testdata/testoutput2
===================================================================
--- code/trunk/testdata/testoutput2 2012-02-25 17:02:23 UTC (rev 936)
+++ code/trunk/testdata/testoutput2 2012-02-26 15:58:56 UTC (rev 937)
@@ -12271,4 +12271,11 @@
\r\r\r\P\P
0: \x0d\x0d
+/-- This one is here because Perl does not match: it seems to allow the COMMIT
+to escape from the assertion. --/
+
+/(?=a(*COMMIT)b|ac)ac|ac/
+ ac
+ 0: ac
+
/-- End of testinput2 --/