[Pcre-svn] [888] code/trunk: Fix MARK bug for assertions.

Top Page
Delete this message
Author: Subversion repository
Date:  
To: pcre-svn
Subject: [Pcre-svn] [888] code/trunk: Fix MARK bug for assertions.
Revision: 888
          http://vcs.pcre.org/viewvc?view=rev&revision=888
Author:   ph10
Date:     2012-01-17 14:43:23 +0000 (Tue, 17 Jan 2012)


Log Message:
-----------
Fix MARK bug for assertions.

Modified Paths:
--------------
    code/trunk/ChangeLog
    code/trunk/pcre_exec.c
    code/trunk/testdata/testinput2
    code/trunk/testdata/testoutput2


Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog    2012-01-17 14:32:32 UTC (rev 887)
+++ code/trunk/ChangeLog    2012-01-17 14:43:23 UTC (rev 888)
@@ -42,7 +42,8 @@
     "x". The similar pattern /(?=(*:x))((*:y)q|)/ did not return a mark at all. 
     Oddly, Perl behaves the same way. PCRE has been fixed so that this pattern 
     also returns the mark "x". This bug applied to capturing parentheses, 
-    non-capturing parentheses, and atomic parentheses. 
+    non-capturing parentheses, and atomic parentheses. It also applied to some 
+    assertions.


 12. Stephen Kelly's patch to CMakeLists.txt allows it to parse the version 
     information out of configure.ac instead of relying on pcre.h.generic, which 


Modified: code/trunk/pcre_exec.c
===================================================================
--- code/trunk/pcre_exec.c    2012-01-17 14:32:32 UTC (rev 887)
+++ code/trunk/pcre_exec.c    2012-01-17 14:43:23 UTC (rev 888)
@@ -1530,6 +1530,7 @@


     case OP_ASSERT:
     case OP_ASSERTBACK:
+    save_mark = md->mark; 
     if (md->match_function_type == MATCH_CONDASSERT)
       {
       condassert = TRUE;
@@ -1551,6 +1552,7 @@


       if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN) RRETURN(rrc);
       ecode += GET(ecode, 1);
+      md->mark = save_mark; 
       }
     while (*ecode == OP_ALT);


@@ -1574,6 +1576,7 @@

     case OP_ASSERT_NOT:
     case OP_ASSERTBACK_NOT:
+    save_mark = md->mark; 
     if (md->match_function_type == MATCH_CONDASSERT)
       {
       condassert = TRUE;
@@ -1584,6 +1587,7 @@
     do
       {
       RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, NULL, RM5);
+      md->mark = save_mark; 
       if (rrc == MATCH_MATCH || rrc == MATCH_ACCEPT) RRETURN(MATCH_NOMATCH);
       if (rrc == MATCH_SKIP || rrc == MATCH_PRUNE || rrc == MATCH_COMMIT)
         {


Modified: code/trunk/testdata/testinput2
===================================================================
--- code/trunk/testdata/testinput2    2012-01-17 14:32:32 UTC (rev 887)
+++ code/trunk/testdata/testinput2    2012-01-17 14:43:23 UTC (rev 888)
@@ -3595,4 +3595,10 @@
 /(?=(*:x))(?>(*:y)q|)/K+
     abc


+/(?=a(*:x))(?!a(*:y)c)/K+
+    ab
+
+/(?=a(*:x))(?=a(*:y)c|)/K+
+    ab
+
 /-- End of testinput2 --/


Modified: code/trunk/testdata/testoutput2
===================================================================
--- code/trunk/testdata/testoutput2    2012-01-17 14:32:32 UTC (rev 887)
+++ code/trunk/testdata/testoutput2    2012-01-17 14:43:23 UTC (rev 888)
@@ -11999,4 +11999,16 @@
  0+ abc
 MK: x


+/(?=a(*:x))(?!a(*:y)c)/K+
+    ab
+ 0: 
+ 0+ ab
+MK: x
+
+/(?=a(*:x))(?=a(*:y)c|)/K+
+    ab
+ 0: 
+ 0+ ab
+MK: x
+
 /-- End of testinput2 --/