Change 33324 by [EMAIL PROTECTED] on 2008/02/17 15:39:22

        Fix perlbug 50114 and document what the code does a bit better

Affected files ...

... //depot/perl/regcomp.c#650 edit
... //depot/perl/t/op/re_tests#129 edit

Differences ...

==== //depot/perl/regcomp.c#650 (text) ====
Index: perl/regcomp.c
--- perl/regcomp.c#649~33291~   2008-02-12 05:15:20.000000000 -0800
+++ perl/regcomp.c      2008-02-17 07:39:22.000000000 -0800
@@ -4462,7 +4462,17 @@
         regnode *first= scan;
         regnode *first_next= regnext(first);
        
-       /* Skip introductions and multiplicators >= 1. */
+       /*
+        * Skip introductions and multiplicators >= 1
+        * so that we can extract the 'meat' of the pattern that must 
+        * match in the large if() sequence following.
+        * NOTE that EXACT is NOT covered here, as it is normally
+        * picked up by the optimiser separately. 
+        *
+        * This is unfortunate as the optimiser isnt handling lookahead
+        * properly currently.
+        *
+        */
        while ((OP(first) == OPEN && (sawopen = 1)) ||
               /* An OR of *one* alternative - should not happen now. */
            (OP(first) == BRANCH && OP(first_next) != BRANCH) ||
@@ -4474,16 +4484,17 @@
            (PL_regkind[OP(first)] == CURLY && ARG1(first) > 0) ||
            (OP(first) == NOTHING && PL_regkind[OP(first_next)] != END ))
        {
-               
+               /* 
+                * the only op that could be a regnode is PLUS, all the rest
+                * will be regnode_1 or regnode_2.
+                *
+                */
                if (OP(first) == PLUS)
                    sawplus = 1;
                else
                    first += regarglen[OP(first)];
-               if (OP(first) == IFMATCH) {
-                   first = NEXTOPER(first);
-                   first += EXTRA_STEP_2ARGS;
-               } else  /* XXX possible optimisation for /(?=)/  */
-                   first = NEXTOPER(first);
+               
+               first = NEXTOPER(first);
                first_next= regnext(first);
        }
 

==== //depot/perl/t/op/re_tests#129 (text) ====
Index: perl/t/op/re_tests
--- perl/t/op/re_tests#128~32941~       2008-01-10 14:38:10.000000000 -0800
+++ perl/t/op/re_tests  2008-02-17 07:39:22.000000000 -0800
@@ -1341,3 +1341,6 @@
 .*\z   foo\n   y       -       -
 ^(?:(\d)x)?\d$ 1       y       ${\(defined($1)?1:0)}   0       
 .*?(?:(\w)|(\w))x      abx     y       $1-$2   b-
+
+0{50}  000000000000000000000000000000000000000000000000000     y       -       
-
+
End of Patch.

Reply via email to