summaryrefslogtreecommitdiff
path: root/proto.h
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2020-11-15 20:57:59 -0700
committerKarl Williamson <khw@cpan.org>2021-01-20 06:51:49 -0700
commite513125ac7bdea1f40ab055ab8c72da44de8f869 (patch)
tree7f5b5bbf26fabd9f8c3af261ed83c85da92885eb /proto.h
parenta7b8d88a7db0f93e2ec0bef63f0460d0d3247b10 (diff)
downloadperl-e513125ac7bdea1f40ab055ab8c72da44de8f869.tar.gz
Revamp regcurly(), regpiece() use of it
This commit copies portions of new_regcurly(), which has been around since 5.28, into plain regcurly(), as a baby step in preparation for converting entirely to the new one. These functions are used for parsing {m,n} quantifiers. Future commits will add capabilities not available using the old version. The commit adds an optional parameter, to return to the caller information it gleans during parsing. regpiece() is changed by this commit to use this information, instead of itself reparsing the input. Part of the reason for this commit is that changes are planned soon to what is legal syntax. With this commit in place, those changes only have to be done once. This commit also extracts into a function the calculation of the quantifier bounds. This allows the logic for that to be done in one place instead of two.
Diffstat (limited to 'proto.h')
-rw-r--r--proto.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/proto.h b/proto.h
index 333dde15e6..aa156b4cad 100644
--- a/proto.h
+++ b/proto.h
@@ -5761,6 +5761,9 @@ STATIC SV * S_get_ANYOFM_contents(pTHX_ const regnode * n)
STATIC SV* S_get_ANYOF_cp_list_for_ssc(pTHX_ const RExC_state_t *pRExC_state, const regnode_charclass* const node);
#define PERL_ARGS_ASSERT_GET_ANYOF_CP_LIST_FOR_SSC \
assert(pRExC_state); assert(node)
+STATIC U32 S_get_quantifier_value(pTHX_ RExC_state_t *pRExC_state, const char * start, const char * end);
+#define PERL_ARGS_ASSERT_GET_QUANTIFIER_VALUE \
+ assert(pRExC_state); assert(start); assert(end)
STATIC bool S_grok_bslash_N(pTHX_ RExC_state_t *pRExC_state, regnode_offset* nodep, UV *code_point_p, int* cp_count, I32 *flagp, const bool strict, const U32 depth);
#define PERL_ARGS_ASSERT_GROK_BSLASH_N \
assert(pRExC_state); assert(flagp)
@@ -6149,10 +6152,10 @@ PERL_CALLCONV SV* Perl_invlist_clone(pTHX_ SV* const invlist, SV* newlist);
assert(invlist)
#endif
#if defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_TOKE_C)
-PERL_CALLCONV bool Perl_regcurly(const char *s)
+PERL_CALLCONV bool Perl_regcurly(const char *s, const char *e, const char * result[5])
__attribute__warn_unused_result__;
#define PERL_ARGS_ASSERT_REGCURLY \
- assert(s)
+ assert(s); assert(e)
#endif
#if defined(PERL_IN_REGEXEC_C)