diff options
-rw-r--r-- | embed.fnc | 4 | ||||
-rw-r--r-- | embed.h | 1 | ||||
-rw-r--r-- | proto.h | 5 | ||||
-rw-r--r-- | regexec.c | 50 |
4 files changed, 36 insertions, 24 deletions
@@ -5405,6 +5405,10 @@ ERS |WB_enum|backup_one_WB |NN WB_enum *previous \ |NN const U8 * const strbeg \ |NN U8 **curpos \ |const bool utf8_target +EWi |void |capture_clear |NN regexp *rex \ + |U16 from_ix \ + |U16 to_ix \ + |NN const char *str ERS |char * |find_byclass |NN regexp *prog \ |NN const regnode *c \ |NN char *s \ @@ -1941,6 +1941,7 @@ # define backup_one_LB(a,b,c) S_backup_one_LB(aTHX_ a,b,c) # define backup_one_SB(a,b,c) S_backup_one_SB(aTHX_ a,b,c) # define backup_one_WB(a,b,c,d) S_backup_one_WB(aTHX_ a,b,c,d) +# define capture_clear(a,b,c,d) S_capture_clear(aTHX_ a,b,c,d comma_aDEPTH) # define find_byclass(a,b,c,d,e) S_find_byclass(aTHX_ a,b,c,d,e) # define find_next_masked S_find_next_masked # define find_span_end S_find_span_end @@ -8905,6 +8905,11 @@ Perl_re_exec_indentf(pTHX_ const char *fmt, U32 depth, ...) # endif /* defined(DEBUGGING) */ # if !defined(PERL_NO_INLINE_FUNCTIONS) +PERL_STATIC_INLINE void +S_capture_clear(pTHX_ regexp *rex, U16 from_ix, U16 to_ix, const char *str comma_pDEPTH); +# define PERL_ARGS_ASSERT_CAPTURE_CLEAR \ + assert(rex); assert(str) + PERL_STATIC_INLINE I32 S_foldEQ_latin1_s2_folded(pTHX_ const char *a, const char *b, I32 len); # define PERL_ARGS_ASSERT_FOLDEQ_LATIN1_S2_FOLDED \ @@ -357,29 +357,31 @@ S_regcppush(pTHX_ const regexp *rex, I32 parenfloor, U32 maxopenparen comma_pDEP RXp_LASTPAREN(rex) = n; \ RXp_LASTCLOSEPAREN(rex) = lcp; -#define CAPTURE_CLEAR(from_ix, to_ix, str) \ -STMT_START { \ - U16 my_ix; \ - if (from_ix) { \ - for ( my_ix = from_ix; my_ix <= to_ix; my_ix++ ) { \ - DEBUG_BUFFERS_r(Perl_re_exec_indentf( aTHX_ \ - "CAPTURE_CLEAR %s \\%" IVdf ": " \ - "%" IVdf "(%" IVdf ") .. %" IVdf \ - " => " \ - "%" IVdf "(%" IVdf ") .. %" IVdf \ - "\n", \ - depth, str, (IV)my_ix, \ - (IV)RXp_OFFSp(rex)[my_ix].start, \ - (IV)RXp_OFFSp(rex)[my_ix].start_tmp, \ - (IV)RXp_OFFSp(rex)[my_ix].end, \ - (IV)-1, (IV)-1, (IV)-1)); \ - RXp_OFFSp(rex)[my_ix].start = -1; \ - RXp_OFFSp(rex)[my_ix].start_tmp = -1; \ - RXp_OFFSp(rex)[my_ix].end = -1; \ - } \ - } \ -} STMT_END +PERL_STATIC_INLINE void +S_capture_clear(pTHX_ regexp *rex, U16 from_ix, U16 to_ix, const char *str comma_pDEPTH) { + PERL_ARGS_ASSERT_CAPTURE_CLEAR; + U16 my_ix; + DECLARE_AND_GET_RE_DEBUG_FLAGS; + for ( my_ix = from_ix; my_ix <= to_ix; my_ix++ ) { + DEBUG_BUFFERS_r(Perl_re_exec_indentf( aTHX_ + "CAPTURE_CLEAR %s \\%" IVdf ": " + "%" IVdf "(%" IVdf ") .. %" IVdf + " => " + "%" IVdf "(%" IVdf ") .. %" IVdf + "\n", + depth, str, (IV)my_ix, + (IV)RXp_OFFSp(rex)[my_ix].start, + (IV)RXp_OFFSp(rex)[my_ix].start_tmp, + (IV)RXp_OFFSp(rex)[my_ix].end, + (IV)-1, (IV)-1, (IV)-1)); + RXp_OFFSp(rex)[my_ix].start = -1; + RXp_OFFSp(rex)[my_ix].start_tmp = -1; + RXp_OFFSp(rex)[my_ix].end = -1; + } +} +#define CAPTURE_CLEAR(from_ix, to_ix, str) \ + if (from_ix) capture_clear(rex,from_ix, to_ix, str) STATIC void S_regcppop(pTHX_ regexp *rex, U32 *maxopenparen_p comma_pDEPTH) @@ -6855,7 +6857,7 @@ S_regmatch(pTHX_ regmatch_info *reginfo, char *startpos, regnode *prog) UNWIND_PAREN(ST.lastparen, ST.lastcloseparen); if (ST.after_paren) { assert(ST.before_paren<=rex->nparens && ST.after_paren<=rex->nparens); - CAPTURE_CLEAR(ST.before_paren+1, ST.after_paren,"TRIE_next_fail"); + CAPTURE_CLEAR(ST.before_paren+1, ST.after_paren, "TRIE_next_fail"); } } if (!--ST.accepted) { @@ -9105,7 +9107,7 @@ NULL } REGCP_UNWIND(ST.cp); UNWIND_PAREN(ST.lastparen, ST.lastcloseparen); - CAPTURE_CLEAR(ST.before_paren+1,ST.after_paren,"BRANCH_next_fail"); + CAPTURE_CLEAR(ST.before_paren+1, ST.after_paren, "BRANCH_next_fail"); scan = ST.next_branch; /* no more branches? */ if (!scan || (OP(scan) != BRANCH && OP(scan) != BRANCHJ)) { |