Improve tokenizing wrong number literals

This commit is contained in:
gingerBill
2024-06-28 09:16:01 +01:00
parent 5a9698e8cb
commit 862a04376f
2 changed files with 12 additions and 1 deletions

View File

@@ -718,7 +718,17 @@ gb_internal ExactValue exact_value_from_token(AstFile *f, Token const &token) {
}
ExactValue value = exact_value_from_basic_literal(token.kind, s);
if (value.kind == ExactValue_Invalid) {
syntax_error(token, "Invalid token literal");
switch (token.kind) {
case Token_Integer:
syntax_error(token, "Invalid integer literal");
break;
case Token_Float:
syntax_error(token, "Invalid float literal");
break;
default:
syntax_error(token, "Invalid token literal");
break;
}
}
return value;
}