summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2012-02-26 15:58:56 +0000
committerph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2012-02-26 15:58:56 +0000
commit22ff165865c39cc160b4341664b053707ebfa5e9 (patch)
tree55b8f16eac3286088c8299797599f741ca6cf604
parent0822b327579fbb0b514c6dce3417b8c07b7042cf (diff)
downloadpcre-22ff165865c39cc160b4341664b053707ebfa5e9.tar.gz
Confine (*COMMIT) inside positive assertions, as documented.
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@937 2f5784b3-3f2a-0410-8824-cb99058d5e15
-rw-r--r--ChangeLog7
-rw-r--r--pcre_exec.c8
-rw-r--r--testdata/testinput16
-rw-r--r--testdata/testinput26
-rw-r--r--testdata/testoutput18
-rw-r--r--testdata/testoutput27
6 files changed, 37 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index fe7b954..eb218c0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -55,9 +55,12 @@ Version 8.31
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.
diff --git a/pcre_exec.c b/pcre_exec.c
index 4e54183..bfe2f47 100644
--- a/pcre_exec.c
+++ b/pcre_exec.c
@@ -1576,10 +1576,12 @@ for (;;)
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;
}
diff --git a/testdata/testinput1 b/testdata/testinput1
index 46f324c..7b125f0 100644
--- a/testdata/testinput1
+++ b/testdata/testinput1
@@ -5253,4 +5253,10 @@ name were given. ---/
/(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 --/
diff --git a/testdata/testinput2 b/testdata/testinput2
index cdcda80..ac5db36 100644
--- a/testdata/testinput2
+++ b/testdata/testinput2
@@ -3733,4 +3733,10 @@ replaced by single letters. --/
\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 --/
diff --git a/testdata/testoutput1 b/testdata/testoutput1
index b479ee7..c3202a9 100644
--- a/testdata/testoutput1
+++ b/testdata/testoutput1
@@ -8719,4 +8719,12 @@ No match
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 --/
diff --git a/testdata/testoutput2 b/testdata/testoutput2
index 7324d32..81b7fb9 100644
--- a/testdata/testoutput2
+++ b/testdata/testoutput2
@@ -12271,4 +12271,11 @@ Partial match: \x0d\x0d
\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 --/