mirror of
https://github.com/Perl/perl5.git
synced 2026-01-26 16:39:36 +00:00
regex engine - Rename PL_regarglen to PL_regnode_arg_len
This commit is contained in:
parent
689eab88ca
commit
83ca6c9dc5
@ -59,7 +59,7 @@ PL_reg_extflags_name
|
||||
PL_reg_intflags_name
|
||||
PL_reg_name
|
||||
PL_reg_off_by_arg
|
||||
PL_regarglen
|
||||
PL_regnode_arg_len
|
||||
PL_regargvaries
|
||||
PL_regkind
|
||||
PL_revision
|
||||
|
||||
@ -197,7 +197,7 @@ have been included.
|
||||
|
||||
=back
|
||||
|
||||
F<regnodes.h> defines an array called C<PL_regarglen[]> which gives the size
|
||||
F<regnodes.h> defines an array called C<PL_regnode_arg_len[]> which gives the size
|
||||
of each opcode in units of C<size regnode> (4-byte). A macro is used
|
||||
to calculate the size of an C<EXACT> node based on its C<str_len> field.
|
||||
|
||||
|
||||
42
regcomp.c
42
regcomp.c
@ -3876,7 +3876,7 @@ S_make_trie(pTHX_ RExC_state_t *pRExC_state, regnode *startbranch,
|
||||
DEBUG_r({
|
||||
optimize = convert
|
||||
+ NODE_STEP_REGNODE
|
||||
+ PL_regarglen[ OP( convert ) ];
|
||||
+ PL_regnode_arg_len[ OP( convert ) ];
|
||||
});
|
||||
/* XXX We really should free up the resource in trie now,
|
||||
as we won't use them - (which resources?) dmq */
|
||||
@ -13348,7 +13348,7 @@ S_regpiece(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth)
|
||||
reginsert(pRExC_state, OPFAIL, orig_emit, depth+1);
|
||||
ckWARNreg(RExC_parse, "Quantifier {n,m} with n > m can't match");
|
||||
NEXT_OFF(REGNODE_p(orig_emit)) =
|
||||
PL_regarglen[OPFAIL] + NODE_STEP_REGNODE;
|
||||
PL_regnode_arg_len[OPFAIL] + NODE_STEP_REGNODE;
|
||||
return ret;
|
||||
}
|
||||
else if (min == max && *RExC_parse == '?') {
|
||||
@ -15415,7 +15415,7 @@ S_regatom(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth)
|
||||
* eventually we'll have to artificially chunk the pattern into
|
||||
* multiple nodes. */
|
||||
if (! LOC && (node_type == EXACT || node_type == LEXACT)) {
|
||||
Size_t overhead = 1 + PL_regarglen[OP(REGNODE_p(ret))];
|
||||
Size_t overhead = 1 + PL_regnode_arg_len[OP(REGNODE_p(ret))];
|
||||
Size_t overhead_expansion = 0;
|
||||
char temp[256];
|
||||
Size_t max_nodes_for_string;
|
||||
@ -15434,7 +15434,7 @@ S_regatom(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth)
|
||||
* to save the string in the EXACT case before growing, and
|
||||
* then copy it afterwards to its new location */
|
||||
if (node_type == EXACT) {
|
||||
overhead_expansion = PL_regarglen[LEXACT] - PL_regarglen[EXACT];
|
||||
overhead_expansion = PL_regnode_arg_len[LEXACT] - PL_regnode_arg_len[EXACT];
|
||||
RExC_emit += overhead_expansion;
|
||||
Copy(s0, temp, len, char);
|
||||
}
|
||||
@ -17141,7 +17141,7 @@ redo_curchar:
|
||||
* which isn't legal */
|
||||
|| RExC_emit != orig_emit
|
||||
+ NODE_STEP_REGNODE
|
||||
+ PL_regarglen[REGEX_SET])
|
||||
+ PL_regnode_arg_len[REGEX_SET])
|
||||
{
|
||||
vFAIL("Expecting interpolated extended charclass");
|
||||
}
|
||||
@ -19716,9 +19716,9 @@ S_regclass(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth,
|
||||
}
|
||||
}
|
||||
|
||||
ret = REGNODE_GUTS(pRExC_state, op, PL_regarglen[op]);
|
||||
ret = REGNODE_GUTS(pRExC_state, op, PL_regnode_arg_len[op]);
|
||||
FILL_NODE(ret, op); /* We set the argument later */
|
||||
RExC_emit += NODE_STEP_REGNODE + PL_regarglen[op];
|
||||
RExC_emit += NODE_STEP_REGNODE + PL_regnode_arg_len[op];
|
||||
ANYOF_FLAGS(REGNODE_p(ret)) = anyof_flags;
|
||||
|
||||
/* Here, <cp_list> contains all the code points we can determine at
|
||||
@ -20623,7 +20623,7 @@ S_optimize_regclass(pTHX_
|
||||
* non-UTF8 targets. The internal bitmap would serve
|
||||
* both cases; with some extra code in regexec.c) */
|
||||
op = ANYOFHbbm;
|
||||
*ret = REGNODE_GUTS(pRExC_state, op, PL_regarglen[op]);
|
||||
*ret = REGNODE_GUTS(pRExC_state, op, PL_regnode_arg_len[op]);
|
||||
FILL_NODE(*ret, op);
|
||||
((struct regnode_bbm *) REGNODE_p(*ret))->first_byte = low_utf8[0],
|
||||
|
||||
@ -20639,7 +20639,7 @@ S_optimize_regclass(pTHX_
|
||||
|
||||
((struct regnode_bbm *) REGNODE_p(*ret))->bitmap,
|
||||
REGNODE_BBM_BITMAP_LEN);
|
||||
RExC_emit += NODE_STEP_REGNODE + PL_regarglen[op];
|
||||
RExC_emit += NODE_STEP_REGNODE + PL_regnode_arg_len[op];
|
||||
return op;
|
||||
}
|
||||
else {
|
||||
@ -20649,7 +20649,7 @@ S_optimize_regclass(pTHX_
|
||||
else {
|
||||
op = ANYOFHs;
|
||||
*ret = REGNODE_GUTS(pRExC_state, op,
|
||||
PL_regarglen[op] + STR_SZ(len));
|
||||
PL_regnode_arg_len[op] + STR_SZ(len));
|
||||
FILL_NODE(*ret, op);
|
||||
((struct regnode_anyofhs *) REGNODE_p(*ret))->str_len
|
||||
= len;
|
||||
@ -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_regarglen[op] || PL_regkind[op] == ANYOF);
|
||||
assert(extra_size >= PL_regnode_arg_len[op] || PL_regkind[op] == ANYOF);
|
||||
return S_regnode_guts(aTHX_ pRExC_state, extra_size);
|
||||
}
|
||||
|
||||
@ -21297,12 +21297,12 @@ S_regnode_guts_debug(pTHX_ RExC_state_t *pRExC_state, const U8 op, const STRLEN
|
||||
STATIC regnode_offset /* Location. */
|
||||
S_reg_node(pTHX_ RExC_state_t *pRExC_state, U8 op)
|
||||
{
|
||||
const regnode_offset ret = REGNODE_GUTS(pRExC_state, op, PL_regarglen[op]);
|
||||
const regnode_offset ret = REGNODE_GUTS(pRExC_state, op, PL_regnode_arg_len[op]);
|
||||
regnode_offset ptr = ret;
|
||||
|
||||
PERL_ARGS_ASSERT_REG_NODE;
|
||||
|
||||
assert(PL_regarglen[op] == 0);
|
||||
assert(PL_regnode_arg_len[op] == 0);
|
||||
|
||||
FILL_ADVANCE_NODE(ptr, op);
|
||||
RExC_emit = ptr;
|
||||
@ -21315,13 +21315,13 @@ S_reg_node(pTHX_ RExC_state_t *pRExC_state, U8 op)
|
||||
STATIC regnode_offset /* Location. */
|
||||
S_reganode(pTHX_ RExC_state_t *pRExC_state, U8 op, U32 arg)
|
||||
{
|
||||
const regnode_offset ret = REGNODE_GUTS(pRExC_state, op, PL_regarglen[op]);
|
||||
const regnode_offset ret = REGNODE_GUTS(pRExC_state, op, PL_regnode_arg_len[op]);
|
||||
regnode_offset ptr = ret;
|
||||
|
||||
PERL_ARGS_ASSERT_REGANODE;
|
||||
|
||||
/* ANYOF are special cased to allow non-length 1 args */
|
||||
assert(PL_regarglen[op] == 1);
|
||||
assert(PL_regnode_arg_len[op] == 1);
|
||||
|
||||
FILL_ADVANCE_NODE_ARG(ptr, op, arg);
|
||||
RExC_emit = ptr;
|
||||
@ -21334,7 +21334,7 @@ S_reganode(pTHX_ RExC_state_t *pRExC_state, U8 op, U32 arg)
|
||||
STATIC regnode_offset /* Location. */
|
||||
S_regpnode(pTHX_ RExC_state_t *pRExC_state, U8 op, SV * arg)
|
||||
{
|
||||
const regnode_offset ret = REGNODE_GUTS(pRExC_state, op, PL_regarglen[op]);
|
||||
const regnode_offset ret = REGNODE_GUTS(pRExC_state, op, PL_regnode_arg_len[op]);
|
||||
regnode_offset ptr = ret;
|
||||
|
||||
PERL_ARGS_ASSERT_REGPNODE;
|
||||
@ -21349,12 +21349,12 @@ S_reg2Lanode(pTHX_ RExC_state_t *pRExC_state, const U8 op, const U32 arg1, const
|
||||
{
|
||||
/* emit a node with U32 and I32 arguments */
|
||||
|
||||
const regnode_offset ret = REGNODE_GUTS(pRExC_state, op, PL_regarglen[op]);
|
||||
const regnode_offset ret = REGNODE_GUTS(pRExC_state, op, PL_regnode_arg_len[op]);
|
||||
regnode_offset ptr = ret;
|
||||
|
||||
PERL_ARGS_ASSERT_REG2LANODE;
|
||||
|
||||
assert(PL_regarglen[op] == 2);
|
||||
assert(PL_regnode_arg_len[op] == 2);
|
||||
|
||||
FILL_ADVANCE_NODE_2L_ARG(ptr, op, arg1, arg2);
|
||||
RExC_emit = ptr;
|
||||
@ -21371,7 +21371,7 @@ S_reg2Lanode(pTHX_ RExC_state_t *pRExC_state, const U8 op, const U32 arg1, const
|
||||
* set up NEXT_OFF() of the inserted node if needed. Something like this:
|
||||
*
|
||||
* reginsert(pRExC, OPFAIL, orig_emit, depth+1);
|
||||
* NEXT_OFF(REGNODE_p(orig_emit)) = PL_regarglen[OPFAIL] + NODE_STEP_REGNODE;
|
||||
* NEXT_OFF(REGNODE_p(orig_emit)) = PL_regnode_arg_len[OPFAIL] + NODE_STEP_REGNODE;
|
||||
*
|
||||
* ALSO NOTE - FLAGS(newly-inserted-operator) will be set to 0 as well.
|
||||
*/
|
||||
@ -21382,7 +21382,7 @@ S_reginsert(pTHX_ RExC_state_t *pRExC_state, const U8 op,
|
||||
regnode *src;
|
||||
regnode *dst;
|
||||
regnode *place;
|
||||
const int offset = PL_regarglen[(U8)op];
|
||||
const int offset = PL_regnode_arg_len[(U8)op];
|
||||
const int size = NODE_STEP_REGNODE + offset;
|
||||
DECLARE_AND_GET_RE_DEBUG_FLAGS;
|
||||
|
||||
@ -22980,7 +22980,7 @@ Perl_regnode_after(pTHX_ regnode *p)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return (p + NODE_STEP_REGNODE + PL_regarglen[op]);
|
||||
return (p + NODE_STEP_REGNODE + PL_regnode_arg_len[op]);
|
||||
}
|
||||
|
||||
bool
|
||||
|
||||
@ -412,7 +412,7 @@ struct regnode_ssc {
|
||||
/* The number of (smallest) regnode equivalents that the node 'p' which uses
|
||||
* 'struct regnode_string' occupies. (These are EXACTish nodes and a few
|
||||
* others.) */
|
||||
#define NODE_SZ_STR(p) (STR_SZ(STR_LEN(p)) + 1 + PL_regarglen[(p)->type])
|
||||
#define NODE_SZ_STR(p) (STR_SZ(STR_LEN(p)) + 1 + PL_regnode_arg_len[(p)->type])
|
||||
|
||||
#define setSTR_LEN(p,v) \
|
||||
STMT_START{ \
|
||||
@ -485,7 +485,7 @@ struct regnode_ssc {
|
||||
#define REGNODE_AFTER(p) REGNODE_AFTER_plus((p),0)
|
||||
/* find the regnode after this p by using the opcode we previously extracted
|
||||
* with OP(p) */
|
||||
#define REGNODE_AFTER_opcode(p,op) REGNODE_AFTER_plus((p),PL_regarglen[op])
|
||||
#define REGNODE_AFTER_opcode(p,op) REGNODE_AFTER_plus((p),PL_regnode_arg_len[op])
|
||||
/* find the regnode after this p by using OP(p) to find the regnode type of p */
|
||||
#define REGNODE_AFTER_dynamic(p) REGNODE_AFTER_opcode((p),OP(p))
|
||||
/* find the regnode after this p by using the size of the struct associated with
|
||||
@ -519,13 +519,13 @@ struct regnode_ssc {
|
||||
FILL_ADVANCE_NODE(offset, op); \
|
||||
/* This is used generically for other operations \
|
||||
* that have a longer argument */ \
|
||||
(offset) += PL_regarglen[op]; \
|
||||
(offset) += PL_regnode_arg_len[op]; \
|
||||
} STMT_END
|
||||
#define FILL_ADVANCE_NODE_ARGp(offset, op, arg) \
|
||||
STMT_START { \
|
||||
ARGp_SET(REGNODE_p(offset), arg); \
|
||||
FILL_ADVANCE_NODE(offset, op); \
|
||||
(offset) += PL_regarglen[op]; \
|
||||
(offset) += PL_regnode_arg_len[op]; \
|
||||
} STMT_END
|
||||
#define FILL_ADVANCE_NODE_2L_ARG(offset, op, arg1, arg2) \
|
||||
STMT_START { \
|
||||
|
||||
@ -519,12 +519,12 @@ sub print_regarglen {
|
||||
my ($out)= @_;
|
||||
print $out <<EOP;
|
||||
|
||||
/* PL_regarglen[] - How large is the argument part of the node (in regnodes) */
|
||||
/* PL_regnode_arg_len[] - How large is the argument part of the node (in regnodes) */
|
||||
|
||||
#ifndef DOINIT
|
||||
EXTCONST U8 PL_regarglen[];
|
||||
EXTCONST U8 PL_regnode_arg_len[];
|
||||
#else
|
||||
EXTCONST U8 PL_regarglen[] = {
|
||||
EXTCONST U8 PL_regnode_arg_len[] = {
|
||||
EOP
|
||||
|
||||
foreach my $node (@ops) {
|
||||
|
||||
@ -1735,12 +1735,12 @@ EXTCONST U8 PL_regkind[] = {
|
||||
};
|
||||
#endif
|
||||
|
||||
/* PL_regarglen[] - How large is the argument part of the node (in regnodes) */
|
||||
/* PL_regnode_arg_len[] - How large is the argument part of the node (in regnodes) */
|
||||
|
||||
#ifndef DOINIT
|
||||
EXTCONST U8 PL_regarglen[];
|
||||
EXTCONST U8 PL_regnode_arg_len[];
|
||||
#else
|
||||
EXTCONST U8 PL_regarglen[] = {
|
||||
EXTCONST U8 PL_regnode_arg_len[] = {
|
||||
0, /* END */
|
||||
0, /* SUCCEED */
|
||||
0, /* SBOL */
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user