commit bf2f9d82a848a6a852a4cbba03faf19f744585c1
parent 50941720a2655f290858eb157c9fba601f4f1871
Author: Sebastian <sebastian@sebsite.pw>
Date: Fri, 17 Jun 2022 19:05:51 -0400
hare::lex: disallow f suffix on non-base-10 literals
The spec only details the 0b, 0o, and 0x prefixes for integer literals.
Floating point literals are always treated as decimal.
Signed-off-by: Sebastian <sebastian@sebsite.pw>
Diffstat:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/hare/lex/lex.ha b/hare/lex/lex.ha
@@ -504,7 +504,8 @@ fn lex_literal(lex: *lexer) (token | error) = {
return syntaxerr(loc,
"Expected integer literal");
};
- if (suff is size || r.0 != 'f' && float) {
+ if (suff is size || r.0 != 'f' && float
+ || r.0 == 'f' && base != 10) {
unget(lex, r);
break;
} else {