Change 33325 by [EMAIL PROTECTED] on 2008/02/17 16:53:27

        Fix bug 50496 -- regcomp.c=~s/lastcloseparen/lastparen/g
        -- lastcloseparen is literally the index of the last paren closed
        -- lastparen is index of the highest index paren that has been closed. 
        In nested parens, they will be completely different. 
        'ab'=~/(a(b))/ will have: lastparen = 2, lastcloseparen = 1
        'ab'=~/(a)(b)/ will have: lastparen = lastcloseparen = 1

Affected files ...

... //depot/perl/regcomp.c#651 edit
... //depot/perl/t/op/pat.t#308 edit

Differences ...

==== //depot/perl/regcomp.c#651 (text) ====
Index: perl/regcomp.c
--- perl/regcomp.c#650~33324~   2008-02-17 07:39:22.000000000 -0800
+++ perl/regcomp.c      2008-02-17 08:53:27.000000000 -0800
@@ -5042,6 +5042,7 @@
 Perl_reg_named_buff_nextkey(pTHX_ REGEXP * const r, const U32 flags)
 {
     struct regexp *const rx = (struct regexp *)SvANY(r);
+    GET_RE_DEBUG_FLAGS_DECL;
 
     PERL_ARGS_ASSERT_REG_NAMED_BUFF_NEXTKEY;
 
@@ -5054,7 +5055,7 @@
             SV* sv_dat = HeVAL(temphe);
             I32 *nums = (I32*)SvPVX(sv_dat);
             for ( i = 0; i < SvIVX(sv_dat); i++ ) {
-                if ((I32)(rx->lastcloseparen) >= nums[i] &&
+                if ((I32)(rx->lastparen) >= nums[i] &&
                     rx->offs[nums[i]].start != -1 &&
                     rx->offs[nums[i]].end != -1)
                 {
@@ -5114,7 +5115,7 @@
             SV* sv_dat = HeVAL(temphe);
             I32 *nums = (I32*)SvPVX(sv_dat);
             for ( i = 0; i < SvIVX(sv_dat); i++ ) {
-                if ((I32)(rx->lastcloseparen) >= nums[i] &&
+                if ((I32)(rx->lastparen) >= nums[i] &&
                     rx->offs[nums[i]].start != -1 &&
                     rx->offs[nums[i]].end != -1)
                 {

==== //depot/perl/t/op/pat.t#308 (xtext) ====
Index: perl/t/op/pat.t
--- perl/t/op/pat.t#307~33317~  2008-02-15 03:08:51.000000000 -0800
+++ perl/t/op/pat.t     2008-02-17 08:53:27.000000000 -0800
@@ -3791,10 +3791,10 @@
        }
     }
     iseq($res,1,"$s~=/(?<D>(?<A>foo)\s+(?<B>bar)?\s+(?<C>baz))/");
-    iseq($count,4,"Got 4 keys in %+ via each # TODO bug 50496");
-    iseq([EMAIL PROTECTED], 4, 'Got 4 keys in %+ via keys # TODO bug 50496');
-    iseq("@k","A B C D", "Got expected keys # TODO bug 50496");
-    iseq("@v","bar baz foo foo bar baz", "Got expected values # TODO bug = 
50496");
+    iseq($count,4,"Got 4 keys in %+ via each -- bug 50496");
+    iseq([EMAIL PROTECTED], 4, 'Got 4 keys in %+ via keys -- bug 50496');
+    iseq("@k","A B C D", "Got expected keys -- bug 50496");
+    iseq("@v","bar baz foo foo bar baz", "Got expected values -- bug = 50496");
     eval'
        print for $+{this_key_doesnt_exist};
     ';
End of Patch.

Reply via email to