summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2018-10-14 16:59:50 -0600
committerKarl Williamson <khw@cpan.org>2018-10-20 00:09:55 -0600
commitebc61c6df0a1d53ff385289afdd2552c413ed11d (patch)
treefc41963499340ab70d17c67cb375ec4192ee7ef5
parentbec95d5a289feff3ffa0c7f4f0e461b758c27d5f (diff)
downloadperl-ebc61c6df0a1d53ff385289afdd2552c413ed11d.tar.gz
regcomp.c: Defer setting the OP variant of a regnode
This is in preparation for a future commit. We have allocated space and know that the regnode will be some time of ANYOF one. But we don't need to know which one precisely until later than we had been setting it.
-rw-r--r--regcomp.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/regcomp.c b/regcomp.c
index 290f8b4749..eaf8d47bb3 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -16574,6 +16574,7 @@ S_regclass(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth,
one. */
U8 anyof_flags = 0; /* flag bits if the node is an ANYOF-type */
U32 posixl = 0; /* bit field of posix classes matched under /l */
+ bool use_anyofd = FALSE; /* ? Is this to be an ANYOFD node */
GET_RE_DEBUG_FLAGS_DECL;
@@ -18378,7 +18379,7 @@ S_regclass(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth,
&& ( has_upper_latin1_only_utf8_matches
|| (anyof_flags & ANYOF_SHARED_d_MATCHES_ALL_NON_UTF8_NON_ASCII_non_d_WARN_SUPER)))
{
- OP(REGNODE_p(ret)) = ANYOFD;
+ use_anyofd = TRUE;
optimizable = FALSE;
}
@@ -18389,7 +18390,7 @@ S_regclass(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth,
* */
if ( cp_list
&& invert
- && OP(REGNODE_p(ret)) != ANYOFD
+ && ! use_anyofd
&& ! (anyof_flags & (ANYOF_LOCALE_FLAGS))
&& ! HAS_NONLOCALE_RUNTIME_PROPERTY_DEFINITION)
{
@@ -18710,6 +18711,14 @@ S_regclass(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth,
}
}
+ /* It's going to be an ANYOF node. */
+ OP(REGNODE_p(ret)) = (use_anyofd)
+ ? ANYOFD
+ : ((posixl)
+ ? ANYOFPOSIXL
+ : ((LOC)
+ ? ANYOFL
+ : ANYOF));
ANYOF_FLAGS(REGNODE_p(ret)) = anyof_flags;
/* Here, <cp_list> contains all the code points we can determine at