Skip to content

Commit 628b1c0

Browse files
committed
S_scan_ident: Replace redundant code with function call
The previous two commits moved some code into a function. This commit takes very similar code and replaces it with a call to that function.
1 parent af8590c commit 628b1c0

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

toke.c

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10579,17 +10579,11 @@ S_scan_ident(pTHX_ char *s, char *dest, char *dest_end, bool chk_unary)
1057910579

1058010580
/* special case to handle ${10}, ${11} the same way we handle $1 etc */
1058110581
if (isDIGIT(*d)) {
10582-
bool is_zero = *d == '0';
10583-
char *digit_start= d;
10584-
while (s < PL_bufend && isDIGIT(*s)) {
10585-
d++;
10586-
if (d >= e)
10587-
croak("%s", ident_too_long);
10588-
*d= *s++;
10589-
}
10590-
if (is_zero && d - digit_start >= 1) /* d points at the last digit */
10591-
croak(ident_var_zero_multi_digit);
10592-
d[1] = '\0';
10582+
s = parse_ident(s - 1, PL_bufend, &d, e, is_utf8,
10583+
STOP_AT_FIRST_NON_DIGIT);
10584+
10585+
/* The code below is expecting d to point to the final digit */
10586+
d--;
1059310587
}
1059410588

1059510589
/* Convert $^F, ${^F} and the ^F of ${^FOO} to control characters */

0 commit comments

Comments
 (0)