summaryrefslogtreecommitdiff
path: root/regcomp.c
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2020-04-03 11:46:20 -0600
committerKarl Williamson <khw@cpan.org>2020-10-16 07:01:41 -0600
commitad07094c004f4fa3ec82a1dee333e36963824ad1 (patch)
treed87fc543b084faa2cb72cc5fcc38124bf2b097d2 /regcomp.c
parent95f5a9192aec499cfcb88b39a66919cc67ed6c7d (diff)
downloadperl-ad07094c004f4fa3ec82a1dee333e36963824ad1.tar.gz
regcomp.c: Simplify
This was a case statement of every type of EXACTish node. Instead, there is a simple way to see if something is EXACTish.
Diffstat (limited to 'regcomp.c')
-rw-r--r--regcomp.c29
1 files changed, 7 insertions, 22 deletions
diff --git a/regcomp.c b/regcomp.c
index 66ac07e1d6..43f6b88d02 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -20761,30 +20761,15 @@ S_regtail_study(pTHX_ RExC_state_t *pRExC_state, regnode_offset p,
}
#endif
if ( exact ) {
- switch (OP(REGNODE_p(scan))) {
- case LEXACT:
- case EXACT:
- case LEXACT_REQ8:
- case EXACT_REQ8:
- case EXACTL:
- case EXACTF:
- case EXACTFU_S_EDGE:
- case EXACTFAA_NO_TRIE:
- case EXACTFAA:
- case EXACTFU:
- case EXACTFU_REQ8:
- case EXACTFLU8:
- case EXACTFUP:
- case EXACTFL:
- if( exact == PSEUDO )
- exact= OP(REGNODE_p(scan));
- else if ( exact != OP(REGNODE_p(scan)) )
- exact= 0;
- case NOTHING:
- break;
- default:
+ if (PL_regkind[OP(REGNODE_p(scan))] == EXACT) {
+ if (exact == PSEUDO )
+ exact= OP(REGNODE_p(scan));
+ else if (exact != OP(REGNODE_p(scan)) )
exact= 0;
}
+ else if (OP(REGNODE_p(scan)) != NOTHING) {
+ exact= 0;
+ }
}
DEBUG_PARSE_r({
DEBUG_PARSE_MSG((scan==p ? "tsdy" : ""));