Permalink
Browse files

regcomp.c: Rename macro and label

These move away from talking about pass 1, in preparation for future
commits.
  • Loading branch information...
khwilliamson committed Oct 7, 2018
1 parent 6a6aede commit 0acc902b29eede805230641c44b0c7ad621bcfbf
Showing with 27 additions and 27 deletions.
  1. +27 −27 regcomp.c
View
@@ -312,9 +312,9 @@ struct RExC_state_t {
#define SPSTART 0x04 /* Starts with * or + */
#define POSTPONED 0x08 /* (?1),(?&name), (??{...}) or similar */
#define TRYAGAIN 0x10 /* Weeded out a declaration. */
#define RESTART_PASS1 0x20 /* Need to restart sizing pass */
#define NEED_UTF8 0x40 /* In conjunction with RESTART_PASS1, need to
calculate sizes as UTF-8 */
#define RESTART_PARSE 0x20 /* Need to redo the parse */
#define NEED_UTF8 0x40 /* In conjunction with RESTART_PARSE, need to
calcuate sizes as UTF-8 */
#define REG_NODE_NUM(x) ((x) ? (int)((x)-RExC_emit_start) : -1)
@@ -336,7 +336,7 @@ struct RExC_state_t {
#define REQUIRE_UTF8(flagp) STMT_START { \
if (!UTF) { \
assert(PASS1); \
*flagp = RESTART_PASS1|NEED_UTF8; \
*flagp = RESTART_PARSE|NEED_UTF8; \
return 0; \
} \
} STMT_END
@@ -352,19 +352,19 @@ struct RExC_state_t {
set_regex_charset(&RExC_flags, REGEX_UNICODE_CHARSET); \
RExC_uni_semantics = 1; \
if (RExC_seen_unfolded_sharp_s) { \
*flagp |= RESTART_PASS1; \
*flagp |= RESTART_PARSE; \
return restart_retval; \
} \
} \
} STMT_END
/* Executes a return statement with the value 'X', if 'flags' contains any of
* 'RESTART_PASS1', 'NEED_UTF8', or 'extra'. If so, *flagp is set to those
* 'RESTART_PARSE', 'NEED_UTF8', or 'extra'. If so, *flagp is set to those
* flags */
#define RETURN_X_ON_RESTART_OR_FLAGS(X, flags, flagp, extra) \
STMT_START { \
if ((flags) & (RESTART_PASS1|NEED_UTF8|(extra))) { \
*(flagp) = (flags) & (RESTART_PASS1|NEED_UTF8|(extra)); \
if ((flags) & (RESTART_PARSE|NEED_UTF8|(extra))) { \
*(flagp) = (flags) & (RESTART_PARSE|NEED_UTF8|(extra)); \
return X; \
} \
} STMT_END
@@ -377,9 +377,9 @@ struct RExC_state_t {
#define RETURN_FAIL_ON_RESTART_FLAGP_OR_FLAGS(flagp,extra) \
if (*(flagp) & (RESTART_PASS1|(extra))) return 0
if (*(flagp) & (RESTART_PARSE|(extra))) return 0
#define MUST_RESTART(flags) ((flags) & (RESTART_PASS1))
#define MUST_RESTART(flags) ((flags) & (RESTART_PARSE))
#define RETURN_FAIL_ON_RESTART(flags,flagp) \
RETURN_X_ON_RESTART(0, flags,flagp)
@@ -7136,7 +7136,7 @@ Perl_re_op_compile(pTHX_ SV ** const patternp, int pat_count,
PL_colors[4], PL_colors[5], s);
});
redo_first_pass:
redo_parse:
/* we jump here if we have to recompile, e.g., from upgrading the pattern
* to utf8 */
@@ -7191,7 +7191,7 @@ Perl_re_op_compile(pTHX_ SV ** const patternp, int pat_count,
* got compiled as utf8. Try again with a utf8 pattern */
S_pat_upgrade_to_utf8(aTHX_ pRExC_state, &exp, &plen,
pRExC_state->code_blocks ? pRExC_state->code_blocks->count : 0);
goto redo_first_pass;
goto redo_parse;
}
}
assert(!pRExC_state->runtime_code_qr);
@@ -7274,7 +7274,7 @@ Perl_re_op_compile(pTHX_ SV ** const patternp, int pat_count,
DEBUG_PARSE_r(Perl_re_printf( aTHX_ "Need to redo pass 1\n"));
}
goto redo_first_pass;
goto redo_parse;
}
Perl_croak(aTHX_ "panic: reg returned failure to re_op_compile for sizing pass, flags=%#" UVxf, (UV) flags);
}
@@ -10715,7 +10715,7 @@ S_handle_named_backref(pTHX_ RExC_state_t *pRExC_state,
*
* Returns 0 otherwise, with *flagp set to indicate why:
* TRYAGAIN at the end of (?) that only sets flags.
* RESTART_PASS1 if the sizing scan needs to be restarted, or'd with
* RESTART_PARSE if the sizing scan needs to be restarted, or'd with
* NEED_UTF8 if the pattern needs to be upgraded to UTF-8.
* Otherwise would only return 0 if regbranch() returns 0, which cannot
* happen. */
@@ -10989,8 +10989,8 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I32 paren, I32 *flagp, U32 depth)
RExC_in_script_run = 1;
atomic = reg(pRExC_state, 'r', &flags, depth);
if (flags & (RESTART_PASS1|NEED_UTF8)) {
*flagp = flags & (RESTART_PASS1|NEED_UTF8);
if (flags & (RESTART_PARSE|NEED_UTF8)) {
*flagp = flags & (RESTART_PARSE|NEED_UTF8);
return 0;
}
@@ -11971,7 +11971,7 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I32 paren, I32 *flagp, U32 depth)
* On success, returns the offset at which any next node should be placed into
* the regex engine program being compiled.
*
* Returns 0 otherwise, setting flagp to RESTART_PASS1 if the sizing scan needs
* Returns 0 otherwise, setting flagp to RESTART_PARSE if the sizing scan needs
* to be restarted, or'd with NEED_UTF8 if the pattern needs to be upgraded to
* UTF-8
*/
@@ -12055,7 +12055,7 @@ S_regbranch(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, I32 first, U32 depth)
*
* Returns 0 otherwise, with *flagp set to indicate why:
* TRYAGAIN if regatom() returns 0 with TRYAGAIN.
* RESTART_PASS1 if the sizing scan needs to be restarted, or'd with
* RESTART_PARSE if the sizing scan needs to be restarted, or'd with
* NEED_UTF8 if the pattern needs to be upgraded to UTF-8.
*/
STATIC regnode_offset
@@ -12357,7 +12357,7 @@ S_grok_bslash_N(pTHX_ RExC_state_t *pRExC_state,
* latter occurs only when the fourth possibility would otherwise be in
* effect, and is because one of those code points requires the pattern to be
* recompiled as UTF-8. The function returns FALSE, and sets the
* RESTART_PASS1 and NEED_UTF8 flags in *flagp, as appropriate. When this
* RESTART_PARSE and NEED_UTF8 flags in *flagp, as appropriate. When this
* happens, the caller needs to desist from continuing parsing, and return
* this information to its caller. This is not set for when there is only one
* code point, as this can be called as part of an ANYOF node, and they can
@@ -12918,7 +12918,7 @@ S_backref_value(char *p, char *e)
at which any next regnode should be placed.
Returns 0, setting *flagp to TRYAGAIN if reg() returns 0 with TRYAGAIN.
Returns 0, setting *flagp to RESTART_PASS1 if the sizing scan needs to be
Returns 0, setting *flagp to RESTART_PARSE if the sizing scan needs to be
restarted, or'd with NEED_UTF8 if the pattern needs to be upgraded to UTF-8
Otherwise does not return 0.
@@ -13342,7 +13342,7 @@ S_regatom(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth)
NULL,
NULL);
RETURN_FAIL_ON_RESTART_FLAGP(flagp);
/* regclass() can only return RESTART_PASS1 and NEED_UTF8 if
/* regclass() can only return RESTART_PARSE and NEED_UTF8 if
* multi-char folds are allowed. */
if (!ret)
FAIL2("panic: regclass returned failure to regatom, flags=%#" UVxf,
@@ -15441,7 +15441,7 @@ S_handle_regex_sets(pTHX_ RExC_state_t *pRExC_state, SV** return_invlist,
RExC_parse++;
}
/* regclass() can only return RESTART_PASS1 and NEED_UTF8
/* regclass() can only return RESTART_PARSE and NEED_UTF8
* if multi-char folds are allowed. */
if (!regclass(pRExC_state, flagp, depth+1,
is_posix_class, /* parse the whole char
@@ -15718,7 +15718,7 @@ S_handle_regex_sets(pTHX_ RExC_state_t *pRExC_state, SV** return_invlist,
break;
case '\\':
/* regclass() can only return RESTART_PASS1 and NEED_UTF8 if
/* regclass() can only return RESTART_PARSE and NEED_UTF8 if
* multi-char folds are allowed. */
if (!regclass(pRExC_state, flagp, depth+1,
TRUE, /* means parse just the next thing */
@@ -15754,7 +15754,7 @@ S_handle_regex_sets(pTHX_ RExC_state_t *pRExC_state, SV** return_invlist,
RExC_parse++;
}
/* regclass() can only return RESTART_PASS1 and NEED_UTF8 if
/* regclass() can only return RESTART_PARSE and NEED_UTF8 if
* multi-char folds are allowed. */
if (!regclass(pRExC_state, flagp, depth+1,
is_posix_class, /* parse the whole char
@@ -16084,7 +16084,7 @@ S_handle_regex_sets(pTHX_ RExC_state_t *pRExC_state, SV** return_invlist,
* already has all folding taken into consideration, and we don't want
* regclass() to add to that */
RExC_flags &= ~RXf_PMf_FOLD;
/* regclass() can only return RESTART_PASS1 and NEED_UTF8 if multi-char
/* regclass() can only return RESTART_PARSE and NEED_UTF8 if multi-char
* folds are allowed. */
node = regclass(pRExC_state, flagp, depth+1,
FALSE, /* means parse the whole char class */
@@ -16433,7 +16433,7 @@ S_regclass(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth,
* On success, returns the offset at which any next node should be placed
* into the regex engine program being compiled.
*
* Returns 0 otherwise, setting flagp to RESTART_PASS1 if the sizing scan needs
* Returns 0 otherwise, setting flagp to RESTART_PARSE if the sizing scan needs
* to be restarted, or'd with NEED_UTF8 if the pattern needs to be upgraded to
* UTF-8
*/
@@ -17766,7 +17766,7 @@ S_regclass(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth,
ret = reg(pRExC_state, 1, &reg_flags, depth+1);
*flagp |= reg_flags & (HASWIDTH|SIMPLE|SPSTART|POSTPONED|RESTART_PASS1|NEED_UTF8);
*flagp |= reg_flags & (HASWIDTH|SIMPLE|SPSTART|POSTPONED|RESTART_PARSE|NEED_UTF8);
/* And restore so can parse the rest of the pattern */
RExC_parse = save_parse;

0 comments on commit 0acc902

Please sign in to comment.