Change 30236 by [EMAIL PROTECTED] on 2007/02/12 18:33:45

        Subject: Re: [perl #41492] Incorrect match with /(?(DEFINE)(?<A> 
(?&B)+)(?<B> a))/
        From: demerphq <[EMAIL PROTECTED]>
        Date: Mon, 12 Feb 2007 19:15:33 +0100
        Message-ID: <[EMAIL PROTECTED]>

Affected files ...

... //depot/perl/regexec.c#513 edit
... //depot/perl/t/op/re_tests#118 edit

Differences ...

==== //depot/perl/regexec.c#513 (text) ====
Index: perl/regexec.c
--- perl/regexec.c#512~30104~   2007-02-02 22:25:11.000000000 -0800
+++ perl/regexec.c      2007-02-12 10:33:45.000000000 -0800
@@ -122,8 +122,11 @@
 /* TODO: Combine JUMPABLE and HAS_TEXT to cache OP(rn) */
 
 /* for use after a quantifier and before an EXACT-like node -- japhy */
-#define JUMPABLE(rn) ( \
-    OP(rn) == OPEN || OP(rn) == CLOSE || OP(rn) == EVAL || \
+/* it would be nice to rework regcomp.sym to generate this stuff. sigh */
+#define JUMPABLE(rn) (      \
+    OP(rn) == OPEN ||       \
+    (OP(rn) == CLOSE && (!cur_eval || cur_eval->u.eval.close_paren != 
ARG(rn))) || \
+    OP(rn) == EVAL ||   \
     OP(rn) == SUSPEND || OP(rn) == IFMATCH || \
     OP(rn) == PLUS || OP(rn) == MINMOD || \
     OP(rn) == KEEPS || (PL_regkind[OP(rn)] == VERB) || \
@@ -4394,6 +4397,12 @@
                    && UCHARAT(PL_reginput) != ST.c2)
            {
                /* simulate B failing */
+               DEBUG_OPTIMISE_r(
+                   PerlIO_printf(Perl_debug_log,
+                       "%*s  CURLYM Fast bail c1=%"IVdf" c2=%"IVdf"\n",
+                       (int)(REPORT_CODE_OFF+(depth*2)),"",
+                       (IV)ST.c1,(IV)ST.c2
+               ));
                state_num = CURLYM_B_fail;
                goto reenter_switch;
            }

==== //depot/perl/t/op/re_tests#118 (text) ====
Index: perl/t/op/re_tests
--- perl/t/op/re_tests#117~30169~       2007-02-08 00:19:24.000000000 -0800
+++ perl/t/op/re_tests  2007-02-12 10:33:45.000000000 -0800
@@ -1280,3 +1280,6 @@
 (?|(?|(a)|(b))|(?|(c)|(d)))    c       y       $1      c
 (?|(?|(a)|(b))|(?|(c)|(d)))    d       y       $1      d
 (.)(?|(.)(.)x|(.)d)(.) abcde   y       $1-$2-$3-$4-$5- b-c--e--
+#Bug #41492
+(?(DEFINE)(?<A>(?&B)+)(?<B>a))(?&A)    a       y       $&      a
+(?(DEFINE)(?<A>(?&B)+)(?<B>a))(?&A)    aa      y       $&      aa
End of Patch.

Reply via email to