Change 20538 by [EMAIL PROTECTED] on 2003/08/07 05:08:14

        Subject: Re: [perl #23030] Error in negative lookahead with alternations
        From: [EMAIL PROTECTED]
        Date: Thu, 07 Aug 2003 02:44:23 +0100
        Message-Id: <[EMAIL PROTECTED]>

Affected files ...

... //depot/perl/regexec.c#313 edit
... //depot/perl/t/op/re_tests#81 edit

Differences ...

==== //depot/perl/regexec.c#313 (text) ====
Index: perl/regexec.c
--- perl/regexec.c#312~20437~   Fri Aug  1 15:00:30 2003
+++ perl/regexec.c      Wed Aug  6 22:08:14 2003
@@ -87,6 +87,7 @@
 #define RF_warned      2               /* warned about big count? */
 #define RF_evaled      4               /* Did an EVAL with setting? */
 #define RF_utf8                8               /* String contains multibyte chars? */
+#define RF_false       16              /* odd number of nested negatives */
 
 #define UTF ((PL_reg_flags & RF_utf8) != 0)
 
@@ -3204,7 +3205,10 @@
                                      "%*s  already tried at this position...\n",
                                      REPORT_CODE_OFF+PL_regindent*2, "")
                        );
-                       sayNO_SILENT;
+                       if (PL_reg_flags & RF_false)
+                           sayYES;
+                       else
+                           sayNO_SILENT;
                    }
                    PL_reg_poscache[o] |= (1<<b);
                }
@@ -3854,6 +3858,7 @@
            }
            else
                PL_reginput = locinput;
+           PL_reg_flags ^= RF_false;
            goto do_ifmatch;
        case IFMATCH:
            n = 1;
@@ -3869,6 +3874,8 @@
          do_ifmatch:
            inner = NEXTOPER(NEXTOPER(scan));
            if (regmatch(inner) != n) {
+               if (n == 0)
+                   PL_reg_flags ^= RF_false;
              say_no:
                if (logical) {
                    logical = 0;
@@ -3878,6 +3885,8 @@
                else
                    sayNO;
            }
+           if (n == 0)
+               PL_reg_flags ^= RF_false;
          say_yes:
            if (logical) {
                logical = 0;

==== //depot/perl/t/op/re_tests#81 (text) ====
Index: perl/t/op/re_tests
--- perl/t/op/re_tests#80~20387~        Thu Jul 31 12:57:36 2003
+++ perl/t/op/re_tests  Wed Aug  6 22:08:14 2003
@@ -940,3 +940,4 @@
 ^(?:f|o|b){2,3}?(.+?)\1\z      foobarbar       y       $1      bar
 ^.{2,3}?((?:b|a|r)+?)\1\z      foobarbar       y       $1      bar
 ^(?:f|o|b){2,3}?((?:b|a|r)+?)\1\z      foobarbar       y       $1      bar
+.*a(?!(b|cd)*e).*f     ......abef      n       -       -       # [perl #23030]
End of Patch.

Reply via email to