passing scanner

This commit is contained in:
2025-12-17 19:29:58 +01:00
parent 9c329eaaaa
commit 050d369895
2 changed files with 26 additions and 9 deletions
+20 -6
View File
@@ -335,12 +335,26 @@ bool scanner_print_errors(scanner_t *s, FILE *fp) {
bool looks_like_float(scanner_t *s) {
const char *cur = s->cur;
if (*cur == '+' || *cur == '-') cur++;
if (!isdigit((unsigned char)*(cur++))) return false;
while (isdigit((unsigned char)*(cur++)));
if (*cur != '.') return false;
cur++;
return isdigit((unsigned char)*cur);
if (
((*cur) == '+') ||
((*cur) == '-')
) {
cur++;
}
if (!isdigit(((unsigned char)*cur))) {
return false;
} else {
cur++;
}
while (isdigit(((unsigned char)*cur))) {
cur++;
}
if ((*cur) != '.') {
return false;
} else {
cur++;
}
return isdigit(((unsigned char)*cur));
}
bool looks_like_int(scanner_t *s) {