mirror of
https://github.com/janet-lang/janet
synced 2024-11-28 11:09:54 +00:00
Make number syntax a bit stricter - no leading underscores
and no underscores in exponent.
This commit is contained in:
parent
ddba0010b0
commit
dd3fc24a1e
@ -308,8 +308,9 @@ int janet_scan_number(
|
||||
} else if (base == 10 && (*str == 'E' || *str == 'e')) {
|
||||
foundexp = 1;
|
||||
break;
|
||||
} else if (*str != '_') {
|
||||
/* underscores are ignored - can be used for separator */
|
||||
} else if (*str == '_') {
|
||||
if (!seenadigit) goto error;
|
||||
} else {
|
||||
int digit = digit_lookup[*str & 0x7F];
|
||||
if (*str > 127 || digit >= base) goto error;
|
||||
if (seenpoint) ex--;
|
||||
@ -342,10 +343,6 @@ int janet_scan_number(
|
||||
}
|
||||
while (str < end && ee < (INT32_MAX / 40)) {
|
||||
int digit = digit_lookup[*str & 0x7F];
|
||||
if (*str == '_') {
|
||||
str++;
|
||||
continue;
|
||||
}
|
||||
if (*str > 127 || digit >= base) goto error;
|
||||
ee = base * ee + digit;
|
||||
str++;
|
||||
|
Loading…
Reference in New Issue
Block a user