Skip to content

Commit f1e7c09

Browse files
committed
toke.c: S_parse_ident: simplify
The previous commit just moved some code and added comments. This commit takes advantage of the new place, and simplifies the code, using the paradigm from the isWORDCHAR_A clause just below.
1 parent 8e28351 commit f1e7c09

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

toke.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10385,16 +10385,15 @@ S_parse_ident(pTHX_ const char *s, const char * const s_end,
1038510385
else if (stop_at_first_non_digit && isDIGIT_A(*s)) {
1038610386
bool is_zero = *s == '0';
1038710387
char *digit_start= *d;
10388-
*(*d)++ = *s++;
1038910388

1039010389
/* Stop at the first non-digit */
10391-
while (s < s_end && isDIGIT(*s)) {
10390+
do {
10391+
*(*d)++ = *s++;
10392+
1039210393
if (*d >= e) {
1039310394
goto too_long;
1039410395
}
10395-
10396-
*(*d)++ = *s++;
10397-
}
10396+
} while (isDIGIT_A(*s));
1039810397

1039910398
/* Leading zeros are not permitted */
1040010399
if (is_zero && *d - digit_start > 1)

0 commit comments

Comments
 (0)