[Pcre-svn] [1305] code/trunk: Fix open parens in MAKE/SKIP/P…

Startseite
Nachricht löschen
Autor: Subversion repository
Datum:  
To: pcre-svn
Betreff: [Pcre-svn] [1305] code/trunk: Fix open parens in MAKE/SKIP/PRUNE/THEN name bug.
Revision: 1305
          http://vcs.pcre.org/viewvc?view=rev&revision=1305
Author:   ph10
Date:     2013-04-01 15:50:45 +0100 (Mon, 01 Apr 2013)


Log Message:
-----------
Fix open parens in MAKE/SKIP/PRUNE/THEN name bug.

Modified Paths:
--------------
    code/trunk/ChangeLog
    code/trunk/pcre_compile.c
    code/trunk/testdata/testinput1
    code/trunk/testdata/testoutput1


Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog    2013-03-29 14:25:40 UTC (rev 1304)
+++ code/trunk/ChangeLog    2013-04-01 14:50:45 UTC (rev 1305)
@@ -127,7 +127,10 @@


32. Control verbs are handled in the same way in JIT and interpreter.

+33. An opening parenthesis in a MARK/PRUNE/SKIP/THEN name in a pattern that
+    contained a forward subroutine reference caused a compile error.


+
Version 8.32 30-November-2012
-----------------------------


Modified: code/trunk/pcre_compile.c
===================================================================
--- code/trunk/pcre_compile.c    2013-03-29 14:25:40 UTC (rev 1304)
+++ code/trunk/pcre_compile.c    2013-04-01 14:50:45 UTC (rev 1305)
@@ -1409,7 +1409,11 @@
   {
   /* Handle specials such as (*SKIP) or (*UTF8) etc. */


-  if (ptr[1] == CHAR_ASTERISK) ptr += 2;
+  if (ptr[1] == CHAR_ASTERISK) 
+    {
+    ptr += 2;
+    while (ptr < cd->end_pattern && *ptr != CHAR_RIGHT_PARENTHESIS) ptr++;
+    } 


/* Handle a normal, unnamed capturing parenthesis. */

@@ -2130,9 +2134,6 @@
       case OP_MARK:
       case OP_PRUNE_ARG:
       case OP_SKIP_ARG:
-      code += code[1];
-      break;
-
       case OP_THEN_ARG:
       code += code[1];
       break;
@@ -2250,9 +2251,6 @@
       case OP_MARK:
       case OP_PRUNE_ARG:
       case OP_SKIP_ARG:
-      code += code[1];
-      break;
-
       case OP_THEN_ARG:
       code += code[1];
       break;
@@ -2617,9 +2615,6 @@
     case OP_MARK:
     case OP_PRUNE_ARG:
     case OP_SKIP_ARG:
-    code += code[1];
-    break;
-
     case OP_THEN_ARG:
     code += code[1];
     break;


Modified: code/trunk/testdata/testinput1
===================================================================
--- code/trunk/testdata/testinput1    2013-03-29 14:25:40 UTC (rev 1304)
+++ code/trunk/testdata/testinput1    2013-04-01 14:50:45 UTC (rev 1305)
@@ -5576,4 +5576,16 @@
 /^(A(*THEN)B|C(*THEN)D)/
     CD           


+/(*:m(m)(?&y)(?(DEFINE)(?<y>b))/K
+    abc
+
+/(*PRUNE:m(m)(?&y)(?(DEFINE)(?<y>b))/K
+    abc
+
+/(*SKIP:m(m)(?&y)(?(DEFINE)(?<y>b))/K
+    abc
+
+/(*THEN:m(m)(?&y)(?(DEFINE)(?<y>b))/K
+    abc
+
 /-- End of testinput1 --/


Modified: code/trunk/testdata/testoutput1
===================================================================
--- code/trunk/testdata/testoutput1    2013-03-29 14:25:40 UTC (rev 1304)
+++ code/trunk/testdata/testoutput1    2013-04-01 14:50:45 UTC (rev 1305)
@@ -9153,4 +9153,23 @@
  0: CD
  1: CD


+/(*:m(m)(?&y)(?(DEFINE)(?<y>b))/K
+    abc
+ 0: b
+MK: m(m
+
+/(*PRUNE:m(m)(?&y)(?(DEFINE)(?<y>b))/K
+    abc
+ 0: b
+MK: m(m
+
+/(*SKIP:m(m)(?&y)(?(DEFINE)(?<y>b))/K
+    abc
+ 0: b
+
+/(*THEN:m(m)(?&y)(?(DEFINE)(?<y>b))/K
+    abc
+ 0: b
+MK: m(m
+
 /-- End of testinput1 --/