summaryrefslogtreecommitdiff
path: root/regexec.c
diff options
context:
space:
mode:
authorYves Orton <demerphq@gmail.com>2023-01-08 15:49:04 +0100
committerYves Orton <demerphq@gmail.com>2023-01-19 18:44:49 +0800
commitc224bbd5d135fe48f49b4cc25f10a4977d695145 (patch)
tree5909b6fd666bb025496824a3f8c67715643164a8 /regexec.c
parent09b3a407e87f128d7aecd14f9c8d75dcff9aaaf8 (diff)
downloadperl-c224bbd5d135fe48f49b4cc25f10a4977d695145.tar.gz
regcomp.c - add optimistic eval (*{ ... }) and (**{ ... })
This adds (*{ ... }) and (**{ ... }) as equivalents to (?{ ... }) and (??{ ... }). The only difference being that the star variants are "optimisitic" and are defined to never disable optimisations. This is especially relevant now that use of (?{ ... }) prevents important optimisations anywhere in the pattern, instead of the older and inconsistent rules where it only affected the parts that contained the EVAL. It is also very useful for injecting debugging style expressions to the pattern to understand what the regex engine is actually doing. The older style (?{ ... }) variants would change the regex engines behavior, meaning this was not as effective a tool as it could have been. Similarly it is now possible to test that a given regex optimisation works correctly using (*{ ... }), which was not possible with (?{ ... }).
Diffstat (limited to 'regexec.c')
-rw-r--r--regexec.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/regexec.c b/regexec.c
index a022098380..8a54cfa44f 100644
--- a/regexec.c
+++ b/regexec.c
@@ -8585,7 +8585,7 @@ S_regmatch(pTHX_ regmatch_info *reginfo, char *startpos, regnode *prog)
break;
case LOGICAL: /* modifier for EVAL and IFMATCH */
- logical = scan->flags;
+ logical = scan->flags & EVAL_FLAGS_MASK; /* reserve a bit for optimistic eval */
break;
/*******************************************************************