summaryrefslogtreecommitdiff
path: root/toke.c
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 /toke.c
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 'toke.c')
-rw-r--r--toke.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/toke.c b/toke.c
index cf0a06a44a..fba2382a33 100644
--- a/toke.c
+++ b/toke.c
@@ -3627,7 +3627,7 @@ S_scan_const(pTHX_ char *start)
else if (PL_lex_inpat
&& (*s != 'N'
|| s[1] != '{'
- || regcurly(s + 1)))
+ || regcurly(s + 1, send, NULL)))
{
*d++ = '\\';
goto default_action;
@@ -4353,7 +4353,7 @@ S_intuit_more(pTHX_ char *s, char *e)
/* In a pattern, so maybe we have {n,m}. */
if (*s == '{') {
- if (regcurly(s)) {
+ if (regcurly(s, e, NULL)) {
return FALSE;
}
return TRUE;