summaryrefslogtreecommitdiff
path: root/regcomp_internal.h
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 /regcomp_internal.h
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 'regcomp_internal.h')
-rw-r--r--regcomp_internal.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/regcomp_internal.h b/regcomp_internal.h
index 3ba4667bf3..ac36b8c6f7 100644
--- a/regcomp_internal.h
+++ b/regcomp_internal.h
@@ -1193,6 +1193,9 @@ static const scan_data_t zero_scan_data = {
if (RExC_seen & REG_UNBOUNDED_QUANTIFIER_SEEN) \
Perl_re_printf( aTHX_ "REG_UNBOUNDED_QUANTIFIER_SEEN "); \
\
+ if (RExC_seen & REG_PESSIMIZE_SEEN) \
+ Perl_re_printf( aTHX_ "REG_PESSIMIZE_SEEN "); \
+ \
Perl_re_printf( aTHX_ "\n"); \
});