From: Gurusamy Sarathy Date: Sat, 11 Mar 2000 10:08:47 +0000 (+0000) Subject: fix optimizer bug in /^(?p{"a"})b/ (from Ilya Zakharevich) X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=96776eda41a10f1802094966189301751fcdd558;p=p5sagit%2Fp5-mst-13.2.git fix optimizer bug in /^(?p{"a"})b/ (from Ilya Zakharevich) p4raw-id: //depot/perl@5644 --- diff --git a/regcomp.c b/regcomp.c index 9fbb3df..13fa36c 100644 --- a/regcomp.c +++ b/regcomp.c @@ -1222,7 +1222,7 @@ S_study_chunk(pTHX_ regnode **scanp, I32 *deltap, regnode *last, scan_data_t *da if (data) data->flags |= SF_HAS_EVAL; } - else if (OP(scan) == LOGICAL && scan->flags == 2) { /* Embedded */ + else if (OP(scan) == LOGICAL && scan->flags == 2) { /* Embedded follows */ if (flags & SCF_DO_SUBSTR) { scan_commit(data); data->longest = &(data->longest_float); @@ -1230,6 +1230,7 @@ S_study_chunk(pTHX_ regnode **scanp, I32 *deltap, regnode *last, scan_data_t *da is_inf = is_inf_internal = 1; if (flags & SCF_DO_STCLASS_OR) /* Allow everything */ cl_anything(data->start_class); + flags &= ~SCF_DO_STCLASS; } /* Else: zero-length, ignore. */ scan = regnext(scan); diff --git a/t/op/pat.t b/t/op/pat.t index 103e613..7f20185 100755 --- a/t/op/pat.t +++ b/t/op/pat.t @@ -369,6 +369,10 @@ print "# ans='@ans'\n# expect='$expect'\nnot " if "@ans" ne $expect; print "ok $test\n"; $test++; +print "not " unless "abc" =~ /^(??{"a"})b/; +print "ok $test\n"; +$test++; + my $matched; $matched = qr/\((?:(?>[^()]+)|(??{$matched}))*\)/;