summaryrefslogtreecommitdiff
path: root/regcomp.c
diff options
context:
space:
mode:
authorYves Orton <demerphq@gmail.com>2013-06-13 21:02:36 +0200
committerYves Orton <demerphq@gmail.com>2013-06-13 21:15:00 +0200
commit5f3789aabfaf43d0b9aacbc4e2bf168d1db0e9f2 (patch)
tree0d24793a63dae00653e94e12a14d9ea61e31f5b3 /regcomp.c
parent6fd8c33ab8e814d9071f229419b493eea5a6df0f (diff)
downloadperl-5f3789aabfaf43d0b9aacbc4e2bf168d1db0e9f2.tar.gz
Possessive and non greedy quantifier modifiers are mutually exclusive
When I added support for possessive modifiers it was possible to build perl so that they could be combined even if it made no sense to do so. Later on in relation to Perl #118375 I got confused and thought they were undocumented but legal. So to prevent further confusion, and since nobody has every mentioned it since they were added, I am removing the unusued conditional build logic, and clearly documenting why they aren't allowed.
Diffstat (limited to 'regcomp.c')
-rw-r--r--regcomp.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/regcomp.c b/regcomp.c
index 34261129fa..0033805ef9 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -9702,14 +9702,9 @@ S_regpiece(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth)
/* But the quantifier includes any '?', the non-greedy
* modifier, after the {}, [perl #118375]
- * Likewise the '+', the possessive modifier, and
- * they can be combined too, '?+' is the possessive
- * non-greedy modifier.
+ * Likewise the '+', the possessive modifier. They are mutually exclusive.
*/
- if (RExC_parse < RExC_end && *RExC_parse == '?' ) {
- nextchar(pRExC_state);
- }
- if (RExC_parse < RExC_end && *RExC_parse == '+' ) {
+ if (RExC_parse < RExC_end && (*RExC_parse == '?' || *RExC_parse == '+') ) {
nextchar(pRExC_state);
}
return ret;
@@ -9825,9 +9820,7 @@ S_regpiece(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth)
reginsert(pRExC_state, MINMOD, ret, depth+1);
REGTAIL(pRExC_state, ret, ret + NODE_STEP_REGNODE);
}
-#ifndef REG_ALLOW_MINMOD_SUSPEND
else
-#endif
if (RExC_parse < RExC_end && *RExC_parse == '+') {
regnode *ender;
nextchar(pRExC_state);
@@ -9837,7 +9830,6 @@ S_regpiece(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth)
ret->flags = 0;
ender = reg_node(pRExC_state, TAIL);
REGTAIL(pRExC_state, ret, ender);
- /*ret= ender;*/
}
if (RExC_parse < RExC_end && ISMULT2(RExC_parse)) {