Change 11956 by jhi@alpha on 2001/09/09 12:53:12

        Subject: [PATCH regcomp.c] zero-width assertions CAN be ?'d
        From: "Jeff 'japhy/Marillion' Pinyan" <[EMAIL PROTECTED]>
        Date: Sat, 8 Sep 2001 15:42:30 -0400 (EDT) 
        Message-ID: <[EMAIL PROTECTED]>
        
        Subject: Re: [PATCH t/op/misc.t] regcomp.c patch broke test 
        From: "Jeff 'japhy/Marillion' Pinyan" <[EMAIL PROTECTED]>
        Date: Sat, 8 Sep 2001 18:33:12 -0400 (EDT)
        Message-ID: <[EMAIL PROTECTED]>
        Subject: [PATCH t/lib/warnings/regcomp] (?=...)? gives no warning now
        From: "Jeff 'japhy/Marillion' Pinyan" <[EMAIL PROTECTED]>
        Date: Sat, 8 Sep 2001 18:37:22 -0400 (EDT)
        Message-ID: <[EMAIL PROTECTED]>

Affected files ...

... //depot/perl/regcomp.c#235 edit
... //depot/perl/t/lib/warnings/regcomp#2 edit
... //depot/perl/t/run/kill_perl.t#7 edit

Differences ...

==== //depot/perl/regcomp.c#235 (text) ====
Index: perl/regcomp.c
--- perl/regcomp.c.~1~  Sun Sep  9 07:00:05 2001
+++ perl/regcomp.c      Sun Sep  9 07:00:05 2001
@@ -967,6 +967,7 @@
            regnode *oscan = scan;
            struct regnode_charclass_class this_class;
            struct regnode_charclass_class *oclass = NULL;
+           I32 next_is_eval = 0;
 
            switch (PL_regkind[(U8)OP(scan)]) {
            case WHILEM:                /* End of (?:...)* . */
@@ -1012,6 +1013,7 @@
                    scan->flags = ((lp <= U8_MAX) ? lp : U8_MAX);
                }
                scan = NEXTOPER(scan) + EXTRA_STEP_2ARGS;
+               next_is_eval = (OP(scan) == EVAL);
              do_curly:
                if (flags & SCF_DO_SUBSTR) {
                    if (mincount == 0) scan_commit(pRExC_state,data); /* Cannot extend 
fixed substrings */
@@ -1073,6 +1075,8 @@
                if (!scan)              /* It was not CURLYX, but CURLY. */
                    scan = next;
                if (ckWARN(WARN_REGEXP)
+                      /* ? quantifier ok, except for (?{ ... }) */
+                   && (next_is_eval || !(mincount == 0 && maxcount == 1))
                    && (minnext == 0) && (deltanext == 0)
                    && data && !(data->flags & (SF_HAS_PAR|SF_IN_PAR))
                    && maxcount <= REG_INFTY/3) /* Complement check for big count */

==== //depot/perl/t/lib/warnings/regcomp#2 (text) ====
Index: perl/t/lib/warnings/regcomp
--- perl/t/lib/warnings/regcomp.~1~     Sun Sep  9 07:00:05 2001
+++ perl/t/lib/warnings/regcomp Sun Sep  9 07:00:05 2001
@@ -47,15 +47,6 @@
 EXPECT
 (?=a)* matches null string many times in regex; marked by <-- HERE in m/(?=a)* <-- 
HERE / at - line 4.
 ########
-# regcomp.c [S_study_chunk]
-use warnings 'regexp' ;
-$_ = "" ;
-/(?=a)?/;
-no warnings 'regexp' ;
-/(?=a)?/;
-EXPECT
-Quantifier unexpected on zero-length expression in regex; marked by <-- HERE in 
m/(?=a)? <-- HERE / at - line 4.
-########
 # regcomp.c [S_regatom]
 $x = '\m' ;
 use warnings 'regexp' ;

==== //depot/perl/t/run/kill_perl.t#7 (text) ====
Index: perl/t/run/kill_perl.t
--- perl/t/run/kill_perl.t.~1~  Sun Sep  9 07:00:05 2001
+++ perl/t/run/kill_perl.t      Sun Sep  9 07:00:05 2001
@@ -724,8 +724,6 @@
 ########
 -w
 "x" =~ /(\G?x)?/;      # core dump in 20000716.007
-EXPECT
-Quantifier unexpected on zero-length expression in regex; marked by <-- HERE in 
m/(\G?x)? <-- HERE / at - line 2.
 ########
 # Bug 20010515.004
 my @h = 1 .. 10;
End of Patch.

Reply via email to