|UV code_point|bool downgradable
Ein |U8 |compute_EXACTish|NN RExC_state_t *pRExC_state
Es |void |nextchar |NN RExC_state_t *pRExC_state
+Es |void |skip_to_be_ignored_text|NN RExC_state_t *pRExC_state \
+ |NN char ** p \
+ |const bool force_to_xmod
Ein |char * |reg_skipcomment|NN RExC_state_t *pRExC_state|NN char * p
Es |void |scan_commit |NN const RExC_state_t *pRExC_state \
|NN struct scan_data_t *data \
#define regtail(a,b,c,d) S_regtail(aTHX_ a,b,c,d)
#define scan_commit(a,b,c,d) S_scan_commit(aTHX_ a,b,c,d)
#define set_ANYOF_arg(a,b,c,d,e,f,g) S_set_ANYOF_arg(aTHX_ a,b,c,d,e,f,g)
+#define skip_to_be_ignored_text(a,b,c) S_skip_to_be_ignored_text(aTHX_ a,b,c)
#define ssc_add_range(a,b,c) S_ssc_add_range(aTHX_ a,b,c)
#define ssc_and(a,b,c) S_ssc_and(aTHX_ a,b,c)
#define ssc_anything(a) S_ssc_anything(aTHX_ a)
STATIC void S_set_ANYOF_arg(pTHX_ RExC_state_t* const pRExC_state, regnode* const node, SV* const cp_list, SV* const runtime_defns, SV* const only_utf8_locale_list, SV* const swash, const bool has_user_defined_property);
#define PERL_ARGS_ASSERT_SET_ANYOF_ARG \
assert(pRExC_state); assert(node)
+STATIC void S_skip_to_be_ignored_text(pTHX_ RExC_state_t *pRExC_state, char ** p, const bool force_to_xmod);
+#define PERL_ARGS_ASSERT_SKIP_TO_BE_IGNORED_TEXT \
+ assert(pRExC_state); assert(p)
PERL_STATIC_INLINE void S_ssc_add_range(pTHX_ regnode_ssc *ssc, UV const start, UV const end);
#define PERL_ARGS_ASSERT_SSC_ADD_RANGE \
assert(ssc)
return p;
}
+STATIC void
+S_skip_to_be_ignored_text(pTHX_ RExC_state_t *pRExC_state,
+ char ** p,
+ const bool force_to_xmod
+ )
+{
+ /* If the text at the current parse position '*p' is a '(?#...)' comment,
+ * or if we are under /x or 'force_to_xmod' is TRUE, and the text at '*p'
+ * is /x whitespace, advance '*p' so that on exit it points to the first
+ * byte past all such white space and comments */
+
+ const bool use_xmod = force_to_xmod || (RExC_flags & RXf_PMf_EXTENDED);
+
+ PERL_ARGS_ASSERT_SKIP_TO_BE_IGNORED_TEXT;
+
+ for (;;) {
+ if (RExC_end - (*p) >= 3
+ && *(*p) == '('
+ && *(*p + 1) == '?'
+ && *(*p + 2) == '#')
+ {
+ while (*(*p) != ')') {
+ if ((*p) == RExC_end)
+ FAIL("Sequence (?#... not terminated");
+ (*p)++;
+ }
+ (*p)++;
+ continue;
+ }
+
+ if (use_xmod) {
+ char * new_p = regpatws(pRExC_state, *p,
+ TRUE); /* means recognize comments */
+ if (new_p != *p) {
+ *p = new_p;
+ continue;
+ }
+ }
+
+ break;
+ }
+
+ return;
+}
+
/* nextchar()
Advances the parse position by one byte, unless that byte is the beginning
RExC_parse++;
- for (;;) {
- if (RExC_end - RExC_parse >= 3
- && *RExC_parse == '('
- && RExC_parse[1] == '?'
- && RExC_parse[2] == '#')
- {
- while (*RExC_parse != ')') {
- if (RExC_parse == RExC_end)
- FAIL("Sequence (?#... not terminated");
- RExC_parse++;
- }
- RExC_parse++;
- continue;
- }
- if (RExC_flags & RXf_PMf_EXTENDED) {
- char * p = regpatws(pRExC_state, RExC_parse,
- TRUE); /* means recognize comments */
- if (p != RExC_parse) {
- RExC_parse = p;
- continue;
- }
- }
- break;
- }
+ skip_to_be_ignored_text(pRExC_state, &RExC_parse,
+ FALSE /* Don't assume /x */ );
}
STATIC regnode *