diff options
author | Karl Williamson <khw@cpan.org> | 2020-11-15 20:57:59 -0700 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2021-01-20 06:51:49 -0700 |
commit | e513125ac7bdea1f40ab055ab8c72da44de8f869 (patch) | |
tree | 7f5b5bbf26fabd9f8c3af261ed83c85da92885eb /toke.c | |
parent | a7b8d88a7db0f93e2ec0bef63f0460d0d3247b10 (diff) | |
download | perl-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.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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; |