aboutsummaryrefslogtreecommitdiff
path: root/src/parser.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2024-06-28 09:16:01 +0100
committergingerBill <bill@gingerbill.org>2024-06-28 09:16:01 +0100
commit862a04376f589b23c34700d8e7c746048741e19f (patch)
tree422041df08d57ab421a1eea328b59763d180d5e7 /src/parser.cpp
parent5a9698e8cb8701b122cb484d5fef7e878dae6974 (diff)
Improve tokenizing wrong number literals
Diffstat (limited to 'src/parser.cpp')
-rw-r--r--src/parser.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/parser.cpp b/src/parser.cpp
index 0cd96f5b5..0364e2c2b 100644
--- a/src/parser.cpp
+++ b/src/parser.cpp
@@ -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;
}