Skip to content

Commit 7b37a60

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 d2a0fb8 commit 7b37a60

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
@@ -10633,16 +10633,15 @@ S_parse_ident(pTHX_ const char *s, const char * const s_end,
1063310633
else if (stop_at_first_non_digit && isDIGIT_A(*s)) {
1063410634
bool is_zero = *s == '0';
1063510635
char *digit_start= *d;
10636-
*(*d)++ = *s++;
1063710636

1063810637
/* Stop at the first non-digit */
10639-
while (s < s_end && isDIGIT(*s)) {
10638+
do {
10639+
*(*d)++ = *s++;
10640+
1064010641
if (*d >= e) {
1064110642
goto too_long;
1064210643
}
10643-
10644-
*(*d)++ = *s++;
10645-
}
10644+
} while (isDIGIT_A(*s));
1064610645

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

0 commit comments

Comments
 (0)