mirror of
https://github.com/Perl/perl5.git
synced 2026-01-26 16:39:36 +00:00
regex engine - Rename PL_regkind to PL_regnode_kind
This commit is contained in:
parent
0e4dd64743
commit
3bfb2e3bfb
@ -61,7 +61,7 @@ PL_reg_name
|
||||
PL_reg_off_by_arg
|
||||
PL_regnode_arg_len
|
||||
PL_regnode_arg_len_varies
|
||||
PL_regkind
|
||||
PL_regnode_kind
|
||||
PL_revision
|
||||
PL_runops_dbg
|
||||
PL_runops_std
|
||||
|
||||
102
regcomp.c
102
regcomp.c
@ -1823,7 +1823,7 @@ S_get_ANYOF_cp_list_for_ssc(pTHX_ const RExC_state_t *pRExC_state,
|
||||
SV* invlist = NULL;
|
||||
SV* only_utf8_locale_invlist = NULL;
|
||||
bool new_node_has_latin1 = FALSE;
|
||||
const U8 flags = (PL_regkind[OP(node)] == ANYOF)
|
||||
const U8 flags = (PL_regnode_kind[OP(node)] == ANYOF)
|
||||
? ANYOF_FLAGS(node)
|
||||
: 0;
|
||||
|
||||
@ -1882,7 +1882,7 @@ S_get_ANYOF_cp_list_for_ssc(pTHX_ const RExC_state_t *pRExC_state,
|
||||
}
|
||||
|
||||
/* Add in the points from the bit map */
|
||||
if (PL_regkind[OP(node)] == ANYOF){
|
||||
if (PL_regnode_kind[OP(node)] == ANYOF){
|
||||
for (unsigned i = 0; i < NUM_ANYOF_CODE_POINTS; i++) {
|
||||
if (ANYOF_BITMAP_TEST(node, i)) {
|
||||
unsigned int start = i++;
|
||||
@ -1976,7 +1976,7 @@ S_ssc_and(pTHX_ const RExC_state_t *pRExC_state, regnode_ssc *ssc,
|
||||
* another SSC or a regular ANYOF class. Can create false positives. */
|
||||
|
||||
SV* anded_cp_list;
|
||||
U8 and_with_flags = (PL_regkind[OP(and_with)] == ANYOF)
|
||||
U8 and_with_flags = (PL_regnode_kind[OP(and_with)] == ANYOF)
|
||||
? ANYOF_FLAGS(and_with)
|
||||
: 0;
|
||||
U8 anded_flags;
|
||||
@ -2161,7 +2161,7 @@ S_ssc_or(pTHX_ const RExC_state_t *pRExC_state, regnode_ssc *ssc,
|
||||
|
||||
SV* ored_cp_list;
|
||||
U8 ored_flags;
|
||||
U8 or_with_flags = (PL_regkind[OP(or_with)] == ANYOF)
|
||||
U8 or_with_flags = (PL_regnode_kind[OP(or_with)] == ANYOF)
|
||||
? ANYOF_FLAGS(or_with)
|
||||
: 0;
|
||||
|
||||
@ -4244,20 +4244,20 @@ S_join_exact(pTHX_ RExC_state_t *pRExC_state, regnode *scan,
|
||||
#endif
|
||||
DEBUG_PEEP("join", scan, depth, 0);
|
||||
|
||||
assert(PL_regkind[OP(scan)] == EXACT);
|
||||
assert(PL_regnode_kind[OP(scan)] == EXACT);
|
||||
|
||||
/* Look through the subsequent nodes in the chain. Skip NOTHING, merge
|
||||
* EXACT ones that are mergeable to the current one. */
|
||||
while ( n
|
||||
&& ( PL_regkind[OP(n)] == NOTHING
|
||||
|| (stringok && PL_regkind[OP(n)] == EXACT))
|
||||
&& ( PL_regnode_kind[OP(n)] == NOTHING
|
||||
|| (stringok && PL_regnode_kind[OP(n)] == EXACT))
|
||||
&& NEXT_OFF(n)
|
||||
&& NEXT_OFF(scan) + NEXT_OFF(n) < I16_MAX)
|
||||
{
|
||||
|
||||
if (OP(n) == TAIL || n > next)
|
||||
stringok = 0;
|
||||
if (PL_regkind[OP(n)] == NOTHING) {
|
||||
if (PL_regnode_kind[OP(n)] == NOTHING) {
|
||||
DEBUG_PEEP("skip:", n, depth, 0);
|
||||
NEXT_OFF(scan) += NEXT_OFF(n);
|
||||
next = n + NODE_STEP_REGNODE;
|
||||
@ -4668,7 +4668,7 @@ S_rck_elide_nothing(pTHX_ regnode *node)
|
||||
while (
|
||||
(n = regnext(n))
|
||||
&& (
|
||||
(PL_regkind[OP(n)] == NOTHING && (noff = NEXT_OFF(n)))
|
||||
(PL_regnode_kind[OP(n)] == NOTHING && (noff = NEXT_OFF(n)))
|
||||
|| ((OP(n) == LONGJMP) && (noff = ARG(n)))
|
||||
)
|
||||
&& off + noff < max
|
||||
@ -4799,7 +4799,7 @@ S_study_chunk(pTHX_
|
||||
* parsing code, as each (?:..) is handled by a different invocation of
|
||||
* reg() -- Yves
|
||||
*/
|
||||
if (PL_regkind[OP(scan)] == EXACT
|
||||
if (PL_regnode_kind[OP(scan)] == EXACT
|
||||
&& OP(scan) != LEXACT
|
||||
&& OP(scan) != LEXACT_REQ8
|
||||
&& mutate_ok
|
||||
@ -5456,7 +5456,7 @@ S_study_chunk(pTHX_
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else if (PL_regkind[OP(scan)] == EXACT && ! isEXACTFish(OP(scan))) {
|
||||
else if (PL_regnode_kind[OP(scan)] == EXACT && ! isEXACTFish(OP(scan))) {
|
||||
SSize_t bytelen = STR_LEN(scan), charlen;
|
||||
UV uc;
|
||||
assert(bytelen);
|
||||
@ -5511,7 +5511,7 @@ S_study_chunk(pTHX_
|
||||
flags &= ~SCF_DO_STCLASS;
|
||||
DEBUG_STUDYDATA("end EXACT", data, depth, is_inf, min, stopmin, delta);
|
||||
}
|
||||
else if (PL_regkind[OP(scan)] == EXACT) {
|
||||
else if (PL_regnode_kind[OP(scan)] == EXACT) {
|
||||
/* But OP != EXACT!, so is EXACTFish */
|
||||
SSize_t bytelen = STR_LEN(scan), charlen;
|
||||
const U8 * s = (U8*)STRING(scan);
|
||||
@ -5605,14 +5605,14 @@ S_study_chunk(pTHX_
|
||||
regnode_ssc *oclass = NULL;
|
||||
I32 next_is_eval = 0;
|
||||
|
||||
switch (PL_regkind[OP(scan)]) {
|
||||
switch (PL_regnode_kind[OP(scan)]) {
|
||||
case WHILEM: /* End of (?:...)* . */
|
||||
scan = REGNODE_AFTER_dynamic(scan);
|
||||
goto finish;
|
||||
case PLUS:
|
||||
if (flags & (SCF_DO_SUBSTR | SCF_DO_STCLASS)) {
|
||||
next = REGNODE_AFTER_dynamic(scan);
|
||||
if ( ( PL_regkind[OP(next)] == EXACT
|
||||
if ( ( PL_regnode_kind[OP(next)] == EXACT
|
||||
&& ! isEXACTFish(OP(next)))
|
||||
|| (flags & SCF_DO_STCLASS))
|
||||
{
|
||||
@ -5826,7 +5826,7 @@ S_study_chunk(pTHX_
|
||||
/* Skip open. */
|
||||
nxt = regnext(nxt);
|
||||
if (!REGNODE_SIMPLE(OP(nxt))
|
||||
&& !(PL_regkind[OP(nxt)] == EXACT
|
||||
&& !(PL_regnode_kind[OP(nxt)] == EXACT
|
||||
&& STR_LEN(nxt) == 1))
|
||||
goto nogo;
|
||||
#ifdef DEBUGGING
|
||||
@ -6322,14 +6322,14 @@ S_study_chunk(pTHX_
|
||||
flags &= ~SCF_DO_STCLASS;
|
||||
}
|
||||
}
|
||||
else if (PL_regkind[OP(scan)] == EOL && flags & SCF_DO_SUBSTR) {
|
||||
else if (PL_regnode_kind[OP(scan)] == EOL && flags & SCF_DO_SUBSTR) {
|
||||
data->flags |= (OP(scan) == MEOL
|
||||
? SF_BEFORE_MEOL
|
||||
: SF_BEFORE_SEOL);
|
||||
scan_commit(pRExC_state, data, minlenp, is_inf);
|
||||
|
||||
}
|
||||
else if ( PL_regkind[OP(scan)] == BRANCHJ
|
||||
else if ( PL_regnode_kind[OP(scan)] == BRANCHJ
|
||||
/* Lookbehind, or need to calculate parens/evals/stclass: */
|
||||
&& (scan->flags || data || (flags & SCF_DO_STCLASS))
|
||||
&& (OP(scan) == IFMATCH || OP(scan) == UNLESSM))
|
||||
@ -6580,7 +6580,7 @@ S_study_chunk(pTHX_
|
||||
if (data)
|
||||
data->flags |= SF_HAS_EVAL;
|
||||
}
|
||||
else if ( PL_regkind[OP(scan)] == ENDLIKE ) {
|
||||
else if ( PL_regnode_kind[OP(scan)] == ENDLIKE ) {
|
||||
if (flags & SCF_DO_SUBSTR) {
|
||||
scan_commit(pRExC_state, data, minlenp, is_inf);
|
||||
flags &= ~SCF_DO_SUBSTR;
|
||||
@ -6630,7 +6630,7 @@ S_study_chunk(pTHX_
|
||||
}
|
||||
#ifdef TRIE_STUDY_OPT
|
||||
#ifdef FULL_TRIE_STUDY
|
||||
else if (PL_regkind[OP(scan)] == TRIE) {
|
||||
else if (PL_regnode_kind[OP(scan)] == TRIE) {
|
||||
/* NOTE - There is similar code to this block above for handling
|
||||
BRANCH nodes on the initial study. If you change stuff here
|
||||
check there too. */
|
||||
@ -6694,7 +6694,7 @@ S_study_chunk(pTHX_
|
||||
stopparen, recursed_depth, NULL, f, depth+1,
|
||||
mutate_ok);
|
||||
}
|
||||
if (nextbranch && PL_regkind[OP(nextbranch)]==BRANCH)
|
||||
if (nextbranch && PL_regnode_kind[OP(nextbranch)]==BRANCH)
|
||||
nextbranch= regnext((regnode*)nextbranch);
|
||||
|
||||
if (min1 > (SSize_t)(minnext + trie->minlen))
|
||||
@ -6764,7 +6764,7 @@ S_study_chunk(pTHX_
|
||||
continue;
|
||||
}
|
||||
#else
|
||||
else if (PL_regkind[OP(scan)] == TRIE) {
|
||||
else if (PL_regnode_kind[OP(scan)] == TRIE) {
|
||||
reg_trie_data *trie = (reg_trie_data*)RExC_rxi->data->data[ ARG(scan) ];
|
||||
U8*bang=NULL;
|
||||
|
||||
@ -8458,8 +8458,8 @@ Perl_re_op_compile(pTHX_ SV ** const patternp, int pat_count,
|
||||
(OP(first) == PLUS) ||
|
||||
(OP(first) == MINMOD) ||
|
||||
/* An {n,m} with n>0 */
|
||||
(PL_regkind[OP(first)] == CURLY && ARG1(first) > 0) ||
|
||||
(OP(first) == NOTHING && PL_regkind[OP(first_next)] != END ))
|
||||
(PL_regnode_kind[OP(first)] == CURLY && ARG1(first) > 0) ||
|
||||
(OP(first) == NOTHING && PL_regnode_kind[OP(first_next)] != END ))
|
||||
{
|
||||
/*
|
||||
* the only op that could be a regnode is PLUS, all the rest
|
||||
@ -8481,7 +8481,7 @@ Perl_re_op_compile(pTHX_ SV ** const patternp, int pat_count,
|
||||
again:
|
||||
DEBUG_PEEP("first:", first, 0, 0);
|
||||
/* Ignore EXACT as we deal with it later. */
|
||||
if (PL_regkind[OP(first)] == EXACT) {
|
||||
if (PL_regnode_kind[OP(first)] == EXACT) {
|
||||
if (! isEXACTFish(OP(first))) {
|
||||
NOOP; /* Empty, get anchored substr later. */
|
||||
}
|
||||
@ -8489,7 +8489,7 @@ Perl_re_op_compile(pTHX_ SV ** const patternp, int pat_count,
|
||||
RExC_rxi->regstclass = first;
|
||||
}
|
||||
#ifdef TRIE_STCLASS
|
||||
else if (PL_regkind[OP(first)] == TRIE &&
|
||||
else if (PL_regnode_kind[OP(first)] == TRIE &&
|
||||
((reg_trie_data *)RExC_rxi->data->data[ ARG(first) ])->minlen>0)
|
||||
{
|
||||
/* this can happen only on restudy
|
||||
@ -8500,10 +8500,10 @@ Perl_re_op_compile(pTHX_ SV ** const patternp, int pat_count,
|
||||
#endif
|
||||
else if (REGNODE_SIMPLE(OP(first)))
|
||||
RExC_rxi->regstclass = first;
|
||||
else if (PL_regkind[OP(first)] == BOUND ||
|
||||
PL_regkind[OP(first)] == NBOUND)
|
||||
else if (PL_regnode_kind[OP(first)] == BOUND ||
|
||||
PL_regnode_kind[OP(first)] == NBOUND)
|
||||
RExC_rxi->regstclass = first;
|
||||
else if (PL_regkind[OP(first)] == BOL) {
|
||||
else if (PL_regnode_kind[OP(first)] == BOL) {
|
||||
RExC_rx->intflags |= (OP(first) == MBOL
|
||||
? PREGf_ANCH_MBOL
|
||||
: PREGf_ANCH_SBOL);
|
||||
@ -8518,7 +8518,7 @@ Perl_re_op_compile(pTHX_ SV ** const patternp, int pat_count,
|
||||
else if ((!sawopen || !RExC_sawback) &&
|
||||
!sawlookahead &&
|
||||
(OP(first) == STAR &&
|
||||
PL_regkind[OP(REGNODE_AFTER_dynamic(first))] == REG_ANY) &&
|
||||
PL_regnode_kind[OP(REGNODE_AFTER_dynamic(first))] == REG_ANY) &&
|
||||
!(RExC_rx->intflags & PREGf_ANCH) && !pRExC_state->code_blocks)
|
||||
{
|
||||
/* turn .* into ^.* with an implied $*=1 */
|
||||
@ -8828,7 +8828,7 @@ Perl_re_op_compile(pTHX_ SV ** const patternp, int pat_count,
|
||||
/* It's safe to read through *next only if OP(first) is a regop of
|
||||
* the right type (not EXACT, for example).
|
||||
*/
|
||||
if (PL_regkind[fop] == NOTHING && nop == END)
|
||||
if (PL_regnode_kind[fop] == NOTHING && nop == END)
|
||||
RExC_rx->extflags |= RXf_NULL;
|
||||
else if ((fop == MBOL || (fop == SBOL && !first->flags)) && nop == END)
|
||||
/* when fop is SBOL first->flags will be true only when it was
|
||||
@ -8838,11 +8838,11 @@ Perl_re_op_compile(pTHX_ SV ** const patternp, int pat_count,
|
||||
* See rt #122761 for more details. -- Yves */
|
||||
RExC_rx->extflags |= RXf_START_ONLY;
|
||||
else if (fop == PLUS
|
||||
&& PL_regkind[nop] == POSIXD && FLAGS(next) == CC_SPACE_
|
||||
&& PL_regnode_kind[nop] == POSIXD && FLAGS(next) == CC_SPACE_
|
||||
&& OP(regnext(first)) == END)
|
||||
RExC_rx->extflags |= RXf_WHITE;
|
||||
else if ( RExC_rx->extflags & RXf_SPLIT
|
||||
&& (PL_regkind[fop] == EXACT && ! isEXACTFish(fop))
|
||||
&& (PL_regnode_kind[fop] == EXACT && ! isEXACTFish(fop))
|
||||
&& STR_LEN(first) == 1
|
||||
&& *(STRING(first)) == ' '
|
||||
&& OP(regnext(first)) == END )
|
||||
@ -12898,7 +12898,7 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I32 paren, I32 *flagp, U32 depth)
|
||||
|
||||
/* Hook the tails of the branches to the closing node. */
|
||||
for (br = REGNODE_p(ret); br; br = regnext(br)) {
|
||||
const U8 op = PL_regkind[OP(br)];
|
||||
const U8 op = PL_regnode_kind[OP(br)];
|
||||
regnode *nextoper = REGNODE_AFTER_dynamic(br);
|
||||
if (op == BRANCH) {
|
||||
if (! REGTAIL_STUDY(pRExC_state,
|
||||
@ -12926,7 +12926,7 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I32 paren, I32 *flagp, U32 depth)
|
||||
}
|
||||
if (is_nothing) {
|
||||
regnode * ret_as_regnode = REGNODE_p(ret);
|
||||
br= PL_regkind[OP(ret_as_regnode)] != BRANCH
|
||||
br= PL_regnode_kind[OP(ret_as_regnode)] != BRANCH
|
||||
? regnext(ret_as_regnode)
|
||||
: ret_as_regnode;
|
||||
DEBUG_PARSE_r({
|
||||
@ -16052,7 +16052,7 @@ S_populate_anyof_bitmap_from_invlist(pTHX_ regnode *node, SV** invlist_ptr)
|
||||
PERL_ARGS_ASSERT_POPULATE_ANYOF_BITMAP_FROM_INVLIST;
|
||||
|
||||
/* There is no bitmap for this node type */
|
||||
if (PL_regkind[OP(node)] != ANYOF) {
|
||||
if (PL_regnode_kind[OP(node)] != ANYOF) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -20741,7 +20741,7 @@ S_set_ANYOF_arg(pTHX_ RExC_state_t* const pRExC_state,
|
||||
/* On plain ANYOF nodes without the possibility of a runtime locale
|
||||
* making a difference, maybe there's no information to be gleaned
|
||||
* except for what's in the bitmap */
|
||||
if (PL_regkind[OP(node)] == ANYOF && ! only_utf8_locale_list) {
|
||||
if (PL_regnode_kind[OP(node)] == ANYOF && ! only_utf8_locale_list) {
|
||||
|
||||
/* There are two such cases:
|
||||
* 1) there is no list of code points matched outside the bitmap
|
||||
@ -21283,7 +21283,7 @@ S_regnode_guts(pTHX_ RExC_state_t *pRExC_state, const STRLEN extra_size)
|
||||
STATIC regnode_offset
|
||||
S_regnode_guts_debug(pTHX_ RExC_state_t *pRExC_state, const U8 op, const STRLEN extra_size) {
|
||||
PERL_ARGS_ASSERT_REGNODE_GUTS_DEBUG;
|
||||
assert(extra_size >= PL_regnode_arg_len[op] || PL_regkind[op] == ANYOF);
|
||||
assert(extra_size >= PL_regnode_arg_len[op] || PL_regnode_kind[op] == ANYOF);
|
||||
return S_regnode_guts(aTHX_ pRExC_state, extra_size);
|
||||
}
|
||||
|
||||
@ -21389,7 +21389,7 @@ S_reginsert(pTHX_ RExC_state_t *pRExC_state, const U8 op,
|
||||
PERL_ARGS_ASSERT_REGINSERT;
|
||||
PERL_UNUSED_CONTEXT;
|
||||
PERL_UNUSED_ARG(depth);
|
||||
/* (PL_regkind[(U8)op] == CURLY ? EXTRA_STEP_2ARGS : 0); */
|
||||
/* (PL_regnode_kind[(U8)op] == CURLY ? EXTRA_STEP_2ARGS : 0); */
|
||||
DEBUG_PARSE_FMT("inst"," - %s", PL_reg_name[op]);
|
||||
assert(!RExC_study_started); /* I believe we should never use reginsert once we have started
|
||||
studying. If this is wrong then we need to adjust RExC_recurse
|
||||
@ -21543,7 +21543,7 @@ S_regtail_study(pTHX_ RExC_state_t *pRExC_state, regnode_offset p,
|
||||
for (;;) {
|
||||
regnode * const temp = regnext(REGNODE_p(scan));
|
||||
#ifdef EXPERIMENTAL_INPLACESCAN
|
||||
if (PL_regkind[OP(REGNODE_p(scan))] == EXACT) {
|
||||
if (PL_regnode_kind[OP(REGNODE_p(scan))] == EXACT) {
|
||||
bool unfolded_multi_char; /* Unexamined in this routine */
|
||||
if (join_exact(pRExC_state, scan, &min,
|
||||
&unfolded_multi_char, 1, REGNODE_p(val), depth+1))
|
||||
@ -21551,7 +21551,7 @@ S_regtail_study(pTHX_ RExC_state_t *pRExC_state, regnode_offset p,
|
||||
}
|
||||
#endif
|
||||
if ( exact ) {
|
||||
if (PL_regkind[OP(REGNODE_p(scan))] == EXACT) {
|
||||
if (PL_regnode_kind[OP(REGNODE_p(scan))] == EXACT) {
|
||||
if (exact == PSEUDO )
|
||||
exact= OP(REGNODE_p(scan));
|
||||
else if (exact != OP(REGNODE_p(scan)) )
|
||||
@ -21897,7 +21897,7 @@ Perl_regprop(pTHX_ const regexp *prog, SV *sv, const regnode *o, const regmatch_
|
||||
}
|
||||
sv_catpv(sv, PL_reg_name[op]); /* Take off const! */
|
||||
|
||||
k = PL_regkind[op];
|
||||
k = PL_regnode_kind[op];
|
||||
|
||||
if (k == EXACT) {
|
||||
sv_catpvs(sv, " ");
|
||||
@ -22252,7 +22252,7 @@ Perl_regprop(pTHX_ const regexp *prog, SV *sv, const regnode *o, const regmatch_
|
||||
if (op == ANYOFHs) {
|
||||
Perl_sv_catpvf(aTHX_ sv, " (Leading UTF-8 bytes=%s", _byte_dump_string((U8 *) ((struct regnode_anyofhs *) o)->string, FLAGS(o), 1));
|
||||
}
|
||||
else if (PL_regkind[op] != ANYOF) {
|
||||
else if (PL_regnode_kind[op] != ANYOF) {
|
||||
U8 lowest = (op != ANYOFHr)
|
||||
? FLAGS(o)
|
||||
: LOWEST_ANYOF_HRx_BYTE(FLAGS(o));
|
||||
@ -23734,8 +23734,8 @@ S_dumpuntil(pTHX_ const regexp *r, const regnode *start, const regnode *node,
|
||||
if (op != OPTIMIZED) {
|
||||
if (next == NULL) /* Next ptr. */
|
||||
Perl_re_printf( aTHX_ " (0)");
|
||||
else if (PL_regkind[op] == BRANCH
|
||||
&& PL_regkind[OP(next)] != BRANCH )
|
||||
else if (PL_regnode_kind[op] == BRANCH
|
||||
&& PL_regnode_kind[OP(next)] != BRANCH )
|
||||
Perl_re_printf( aTHX_ " (FAIL)");
|
||||
else
|
||||
Perl_re_printf( aTHX_ " (%" IVdf ")", (IV)(next - start));
|
||||
@ -23743,7 +23743,7 @@ S_dumpuntil(pTHX_ const regexp *r, const regnode *start, const regnode *node,
|
||||
}
|
||||
|
||||
after_print:
|
||||
if (PL_regkind[op] == BRANCHJ) {
|
||||
if (PL_regnode_kind[op] == BRANCHJ) {
|
||||
assert(next);
|
||||
const regnode *nnode = (OP(next) == LONGJMP
|
||||
? regnext((regnode *)next)
|
||||
@ -23752,11 +23752,11 @@ S_dumpuntil(pTHX_ const regexp *r, const regnode *start, const regnode *node,
|
||||
nnode = last;
|
||||
DUMPUNTIL(after, nnode);
|
||||
}
|
||||
else if (PL_regkind[op] == BRANCH) {
|
||||
else if (PL_regnode_kind[op] == BRANCH) {
|
||||
assert(next);
|
||||
DUMPUNTIL(after, next);
|
||||
}
|
||||
else if ( PL_regkind[op] == TRIE ) {
|
||||
else if ( PL_regnode_kind[op] == TRIE ) {
|
||||
const regnode *this_trie = node;
|
||||
const U32 n = ARG(node);
|
||||
const reg_ac_data * const ac = op>=AHOCORASICK ?
|
||||
@ -23797,7 +23797,7 @@ S_dumpuntil(pTHX_ const regexp *r, const regnode *start, const regnode *node,
|
||||
nextbranch= this_trie + trie->jump[0];
|
||||
DUMPUNTIL(this_trie + dist, nextbranch);
|
||||
}
|
||||
if (nextbranch && PL_regkind[OP(nextbranch)]==BRANCH)
|
||||
if (nextbranch && PL_regnode_kind[OP(nextbranch)]==BRANCH)
|
||||
nextbranch= regnext((regnode *)nextbranch);
|
||||
} else {
|
||||
Perl_re_printf( aTHX_ "\n");
|
||||
@ -23811,14 +23811,14 @@ S_dumpuntil(pTHX_ const regexp *r, const regnode *start, const regnode *node,
|
||||
else if ( op == CURLY ) { /* "next" might be very big: optimizer */
|
||||
DUMPUNTIL(after, after + 1); /* +1 is NOT a REGNODE_AFTER */
|
||||
}
|
||||
else if (PL_regkind[op] == CURLY && op != CURLYX) {
|
||||
else if (PL_regnode_kind[op] == CURLY && op != CURLYX) {
|
||||
assert(next);
|
||||
DUMPUNTIL(after, next);
|
||||
}
|
||||
else if ( op == PLUS || op == STAR) {
|
||||
DUMPUNTIL(after, after + 1); /* +1 NOT a REGNODE_AFTER */
|
||||
}
|
||||
else if (PL_regkind[op] == EXACT || op == ANYOFHs) {
|
||||
else if (PL_regnode_kind[op] == EXACT || op == ANYOFHs) {
|
||||
/* Literal string, where present. */
|
||||
node += NODE_SZ_STR(node); /* NOT REGNODE_AFTER! */
|
||||
}
|
||||
@ -23827,7 +23827,7 @@ S_dumpuntil(pTHX_ const regexp *r, const regnode *start, const regnode *node,
|
||||
}
|
||||
if (op == CURLYX || op == OPEN || op == SROPEN)
|
||||
indent++;
|
||||
if (PL_regkind[op] == END)
|
||||
if (PL_regnode_kind[op] == END)
|
||||
break;
|
||||
}
|
||||
CLEAR_OPTSTART;
|
||||
|
||||
@ -306,7 +306,7 @@ struct regnode_ssc {
|
||||
#define set_ANYOF_SYNTHETIC(n) STMT_START{ OP(n) = ANYOF; \
|
||||
NEXT_OFF(n) = 1; \
|
||||
} STMT_END
|
||||
#define is_ANYOF_SYNTHETIC(n) (PL_regkind[OP(n)] == ANYOF && NEXT_OFF(n) == 1)
|
||||
#define is_ANYOF_SYNTHETIC(n) (PL_regnode_kind[OP(n)] == ANYOF && NEXT_OFF(n) == 1)
|
||||
|
||||
/* XXX fix this description.
|
||||
Impose a limit of REG_INFTY on various pattern matching operations
|
||||
|
||||
@ -272,10 +272,10 @@ sub print_process_EXACTish {
|
||||
print $out <<EOP,
|
||||
|
||||
/* Is 'op', known to be of type EXACT, folding? */
|
||||
#define isEXACTFish(op) (__ASSERT_(PL_regkind[op] == EXACT) (PL_EXACTFish_bitmask & (1U << (op - EXACT))))
|
||||
#define isEXACTFish(op) (__ASSERT_(PL_regnode_kind[op] == EXACT) (PL_EXACTFish_bitmask & (1U << (op - EXACT))))
|
||||
|
||||
/* Do only UTF-8 target strings match 'op', known to be of type EXACT? */
|
||||
#define isEXACT_REQ8(op) (__ASSERT_(PL_regkind[op] == EXACT) (PL_EXACT_REQ8_bitmask & (1U << (op - EXACT))))
|
||||
#define isEXACT_REQ8(op) (__ASSERT_(PL_regnode_kind[op] == EXACT) (PL_EXACT_REQ8_bitmask & (1U << (op - EXACT))))
|
||||
|
||||
#ifndef DOINIT
|
||||
EXTCONST U32 PL_EXACTFish_bitmask;
|
||||
@ -460,12 +460,12 @@ sub print_regkind {
|
||||
my ($out)= @_;
|
||||
print $out <<EOP;
|
||||
|
||||
/* PL_regkind[] What type of regop or state is this. */
|
||||
/* PL_regnode_kind[] What type of regop or state is this. */
|
||||
|
||||
#ifndef DOINIT
|
||||
EXTCONST U8 PL_regkind[];
|
||||
EXTCONST U8 PL_regnode_kind[];
|
||||
#else
|
||||
EXTCONST U8 PL_regkind[] = {
|
||||
EXTCONST U8 PL_regnode_kind[] = {
|
||||
EOP
|
||||
use Data::Dumper;
|
||||
foreach my $node (@all) {
|
||||
|
||||
24
regexec.c
24
regexec.c
@ -188,11 +188,11 @@ static const char non_utf8_target_but_utf8_required[]
|
||||
OP(rn) == SUSPEND || OP(rn) == IFMATCH || \
|
||||
OP(rn) == PLUS || OP(rn) == MINMOD || \
|
||||
OP(rn) == KEEPS || \
|
||||
(PL_regkind[OP(rn)] == CURLY && ARG1(rn) > 0) \
|
||||
(PL_regnode_kind[OP(rn)] == CURLY && ARG1(rn) > 0) \
|
||||
)
|
||||
#define IS_EXACT(rn) (PL_regkind[OP(rn)] == EXACT)
|
||||
#define IS_EXACT(rn) (PL_regnode_kind[OP(rn)] == EXACT)
|
||||
|
||||
#define HAS_TEXT(rn) ( IS_EXACT(rn) || PL_regkind[OP(rn)] == REF )
|
||||
#define HAS_TEXT(rn) ( IS_EXACT(rn) || PL_regnode_kind[OP(rn)] == REF )
|
||||
|
||||
/*
|
||||
Search for mandatory following text node; for lookahead, the text must
|
||||
@ -201,7 +201,7 @@ static const char non_utf8_target_but_utf8_required[]
|
||||
#define FIND_NEXT_IMPT(rn) STMT_START { \
|
||||
while (JUMPABLE(rn)) { \
|
||||
const OPCODE type = OP(rn); \
|
||||
if (type == SUSPEND || PL_regkind[type] == CURLY) \
|
||||
if (type == SUSPEND || PL_regnode_kind[type] == CURLY) \
|
||||
rn = REGNODE_AFTER_opcode(rn,type); \
|
||||
else if (type == PLUS) \
|
||||
rn = REGNODE_AFTER_type(rn,tregnode_PLUS); \
|
||||
@ -1485,11 +1485,11 @@ Perl_re_intuit_start(pTHX_
|
||||
* (trie stclasses are too expensive to use here, we are better off to
|
||||
* leave it to regmatch itself) */
|
||||
|
||||
if (progi->regstclass && PL_regkind[OP(progi->regstclass)]!=TRIE) {
|
||||
if (progi->regstclass && PL_regnode_kind[OP(progi->regstclass)]!=TRIE) {
|
||||
const U8* const str = (U8*)STRING(progi->regstclass);
|
||||
|
||||
/* XXX this value could be pre-computed */
|
||||
const SSize_t cl_l = (PL_regkind[OP(progi->regstclass)] == EXACT
|
||||
const SSize_t cl_l = (PL_regnode_kind[OP(progi->regstclass)] == EXACT
|
||||
? (reginfo->is_utf8_pat
|
||||
? (SSize_t)utf8_distance(str + STR_LEN(progi->regstclass), str)
|
||||
: (SSize_t)STR_LEN(progi->regstclass))
|
||||
@ -4050,7 +4050,7 @@ Perl_regexec_flags(pTHX_ REGEXP * const rx, char *stringarg, char *strend,
|
||||
if (minlen) {
|
||||
const OPCODE op = OP(progi->regstclass);
|
||||
/* don't bother with what can't match */
|
||||
if (PL_regkind[op] != EXACT && PL_regkind[op] != TRIE)
|
||||
if (PL_regnode_kind[op] != EXACT && PL_regnode_kind[op] != TRIE)
|
||||
strend = HOPc(strend, -(minlen - 1));
|
||||
}
|
||||
DEBUG_EXECUTE_r({
|
||||
@ -6465,7 +6465,7 @@ S_regmatch(pTHX_ regmatch_info *reginfo, char *startpos, regnode *prog)
|
||||
INDENT_CHARS(depth), "",
|
||||
(IV)(scan - rexi->program),
|
||||
SvPVX_const(prop),
|
||||
(PL_regkind[OP(scan)] == END || !rnext) ?
|
||||
(PL_regnode_kind[OP(scan)] == END || !rnext) ?
|
||||
0 : (IV)(rnext - rexi->program));
|
||||
}
|
||||
);
|
||||
@ -8488,7 +8488,7 @@ S_regmatch(pTHX_ regmatch_info *reginfo, char *startpos, regnode *prog)
|
||||
for (
|
||||
cursor = scan;
|
||||
cursor && ( OP(cursor) != END );
|
||||
cursor = ( PL_regkind[ OP(cursor) ] == END )
|
||||
cursor = ( PL_regnode_kind[ OP(cursor) ] == END )
|
||||
? REGNODE_AFTER_dynamic(cursor)
|
||||
: regnext(cursor)
|
||||
){
|
||||
@ -9061,7 +9061,7 @@ NULL
|
||||
regnode *text_node = ST.B;
|
||||
if (! HAS_TEXT(text_node))
|
||||
FIND_NEXT_IMPT(text_node);
|
||||
if (PL_regkind[OP(text_node)] == EXACT) {
|
||||
if (PL_regnode_kind[OP(text_node)] == EXACT) {
|
||||
if (! S_setup_EXACTISH_ST(aTHX_ text_node,
|
||||
&ST.Binfo, reginfo))
|
||||
{
|
||||
@ -9218,7 +9218,7 @@ NULL
|
||||
if (! HAS_TEXT(text_node))
|
||||
ST.Binfo.count = 0;
|
||||
else {
|
||||
if ( PL_regkind[OP(text_node)] != EXACT ) {
|
||||
if ( PL_regnode_kind[OP(text_node)] != EXACT ) {
|
||||
ST.Binfo.count = 0;
|
||||
}
|
||||
else {
|
||||
@ -9281,7 +9281,7 @@ NULL
|
||||
sayNO;
|
||||
SET_locinput(li);
|
||||
if ((ST.count > ST.min)
|
||||
&& (PL_regkind[OP(ST.B)] == EOL) && (OP(ST.B) != MEOL))
|
||||
&& (PL_regnode_kind[OP(ST.B)] == EOL) && (OP(ST.B) != MEOL))
|
||||
{
|
||||
/* A{m,n} must come at the end of the string, there's
|
||||
* no point in backing off ... */
|
||||
|
||||
10
regnodes.h
10
regnodes.h
@ -1573,12 +1573,12 @@ typedef struct regnode tregnode_WHILEM;
|
||||
#define KEEPS_next_fail_t8_p8 607 /* 0x25f */
|
||||
|
||||
|
||||
/* PL_regkind[] What type of regop or state is this. */
|
||||
/* PL_regnode_kind[] What type of regop or state is this. */
|
||||
|
||||
#ifndef DOINIT
|
||||
EXTCONST U8 PL_regkind[];
|
||||
EXTCONST U8 PL_regnode_kind[];
|
||||
#else
|
||||
EXTCONST U8 PL_regkind[] = {
|
||||
EXTCONST U8 PL_regnode_kind[] = {
|
||||
END, /* END */
|
||||
END, /* SUCCEED */
|
||||
BOL, /* SBOL */
|
||||
@ -2383,10 +2383,10 @@ EXTCONST U8 PL_simple_bitmask[] = {
|
||||
#endif /* DOINIT */
|
||||
|
||||
/* Is 'op', known to be of type EXACT, folding? */
|
||||
#define isEXACTFish(op) (__ASSERT_(PL_regkind[op] == EXACT) (PL_EXACTFish_bitmask & (1U << (op - EXACT))))
|
||||
#define isEXACTFish(op) (__ASSERT_(PL_regnode_kind[op] == EXACT) (PL_EXACTFish_bitmask & (1U << (op - EXACT))))
|
||||
|
||||
/* Do only UTF-8 target strings match 'op', known to be of type EXACT? */
|
||||
#define isEXACT_REQ8(op) (__ASSERT_(PL_regkind[op] == EXACT) (PL_EXACT_REQ8_bitmask & (1U << (op - EXACT))))
|
||||
#define isEXACT_REQ8(op) (__ASSERT_(PL_regnode_kind[op] == EXACT) (PL_EXACT_REQ8_bitmask & (1U << (op - EXACT))))
|
||||
|
||||
#ifndef DOINIT
|
||||
EXTCONST U32 PL_EXACTFish_bitmask;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user