summaryrefslogtreecommitdiff
path: root/regcomp.c
diff options
context:
space:
mode:
authorJeff Pinyan <japhy@pobox.com>2001-09-08 11:42:30 -0400
committerJarkko Hietaniemi <jhi@iki.fi>2001-09-09 12:53:12 +0000
commit727f22e3bfa8ab582ce8ac7dc421247d52c9d694 (patch)
treee90481a4aa4a9fc78aef1893e45ff038b7b416d1 /regcomp.c
parent0106e1e7009c64ce545a45f6eb9370f52b832ad1 (diff)
downloadperl-727f22e3bfa8ab582ce8ac7dc421247d52c9d694.tar.gz
[PATCH regcomp.c] zero-width assertions CAN be ?'d
Date: Sat, 8 Sep 2001 15:42:30 -0400 (EDT) Message-ID: <Pine.GSO.4.21.0109081535480.24489-100000@crusoe.crusoe.net> Subject: Re: [PATCH t/op/misc.t] regcomp.c patch broke test From: "Jeff 'japhy/Marillion' Pinyan" <jeffp@crusoe.net> Date: Sat, 8 Sep 2001 18:33:12 -0400 (EDT) Message-ID: <Pine.GSO.4.21.0109081832030.24489-100000@crusoe.crusoe.net> Subject: [PATCH t/lib/warnings/regcomp] (?=...)? gives no warning now From: "Jeff 'japhy/Marillion' Pinyan" <jeffp@crusoe.net> Date: Sat, 8 Sep 2001 18:37:22 -0400 (EDT) Message-ID: <Pine.GSO.4.21.0109081835340.24489-100000@crusoe.crusoe.net> p4raw-id: //depot/perl@11956
Diffstat (limited to 'regcomp.c')
-rw-r--r--regcomp.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/regcomp.c b/regcomp.c
index c170a4726a..4b07fd229b 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -967,6 +967,7 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_state, regnode **scanp, I32 *deltap, reg
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 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_state, regnode **scanp, I32 *deltap, reg
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 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_state, regnode **scanp, I32 *deltap, reg
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 */