harec

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit f2f5a0c8ef744ac4e282378be0a96d2b2de6de7c
parent b0399d3cbdf97d17d42f6302952e04200513b1df
Author: Eyal Sawady <ecs@d2evs.net>
Date:   Sun, 27 Dec 2020 22:18:55 -0500

lex: fix lexing of floating-point numbers

isfloat should be set only after we've confirmed that it's a
floating-point number. The case in which this comes up is [1, 2, 3...]

Diffstat:
Msrc/lex.c | 5+++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/lex.c b/src/lex.c @@ -293,13 +293,14 @@ lex_literal(struct lexer *lexer, struct token *out) push(lexer, c, true); goto finalize; } - isfloat = true; if (!strchr(base, c = next(lexer, NULL, false))) { push(lexer, c, false); push(lexer, '.', true); goto finalize; + } else { + push(lexer, c, false); } - push(lexer, c, false); + isfloat = true; break; case 'e': if (exp || suff) {