summaryrefslogtreecommitdiff
path: root/regexec.c
diff options
context:
space:
mode:
authorYves Orton <demerphq@gmail.com>2015-10-05 00:03:10 +0200
committerYves Orton <demerphq@gmail.com>2015-10-05 21:10:49 +0200
commitfee505829585692618c3f9bb28a8f0464553ec94 (patch)
treee5c72eddb476af248072d178ddfeeecc0bc4f406 /regexec.c
parenta2b6fd41891602e43754644a7ef0fcbc54d9e656 (diff)
downloadperl-fee505829585692618c3f9bb28a8f0464553ec94.tar.gz
fix perl #126186 make all verbs allow an optional arg
In perl #126186 it was pointed out we had started allowing name arguments for verbs where we did not document them to be supported, albeit in an inconsistent way. The previous patch cleaned up some of the cause of this, but it seems better to just generally allow the existing verbs to all support a mark name argument. So this patch reverses the effect of the previous patch, and makes all verbs, FAIL, ACCEPT, etc, allow an optional argument, and set REGERROR/REGMARK appropriately as well.
Diffstat (limited to 'regexec.c')
-rw-r--r--regexec.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/regexec.c b/regexec.c
index 96def0f2ca..5535a0e736 100644
--- a/regexec.c
+++ b/regexec.c
@@ -6541,7 +6541,9 @@ S_regmatch(pTHX_ regmatch_info *reginfo, char *startpos, regnode *prog)
break;
case ACCEPT: /* (*ACCEPT) */
- if (ARG(scan)){
+ if (scan->flags)
+ sv_yes_mark = MUTABLE_SV(rexi->data->data[ ARG( scan ) ]);
+ if (ARG2L(scan)){
regnode *cursor;
for (cursor=scan;
cursor && OP(cursor)!=END;
@@ -7013,8 +7015,9 @@ NULL
NOT_REACHED; /* NOTREACHED */
case CUTGROUP: /* /(*THEN)/ */
- sv_yes_mark = st->u.mark.mark_name = scan->flags ? NULL :
- MUTABLE_SV(rexi->data->data[ ARG( scan ) ]);
+ sv_yes_mark = st->u.mark.mark_name = scan->flags
+ ? MUTABLE_SV(rexi->data->data[ ARG( scan ) ])
+ : NULL;
PUSH_STATE_GOTO(CUTGROUP_next, next, locinput);
/* NOTREACHED */
NOT_REACHED; /* NOTREACHED */
@@ -7711,7 +7714,7 @@ NULL
/* FALLTHROUGH */
case PRUNE: /* (*PRUNE) */
- if (!scan->flags)
+ if (scan->flags)
sv_yes_mark = sv_commit = MUTABLE_SV(rexi->data->data[ ARG( scan ) ]);
PUSH_STATE_GOTO(COMMIT_next, next, locinput);
/* NOTREACHED */
@@ -7720,8 +7723,12 @@ NULL
case COMMIT_next_fail:
no_final = 1;
/* FALLTHROUGH */
+ sayNO;
+ NOT_REACHED; /* NOTREACHED */
case OPFAIL: /* (*FAIL) */
+ if (scan->flags)
+ sv_commit = MUTABLE_SV(rexi->data->data[ ARG( scan ) ]);
if (logical) {
/* deal with (?(?!)X|Y) properly,
* make sure we trigger the no branch
@@ -7774,7 +7781,7 @@ NULL
NOT_REACHED; /* NOTREACHED */
case SKIP: /* (*SKIP) */
- if (scan->flags) {
+ if (!scan->flags) {
/* (*SKIP) : if we fail we cut here*/
ST.mark_name = NULL;
ST.mark_loc = locinput;