aboutsummaryrefslogtreecommitdiff
path: root/src/parser.cpp
diff options
context:
space:
mode:
authorJeroen van Rijn <Kelimion@users.noreply.github.com>2024-08-17 17:25:52 +0200
committerJeroen van Rijn <Kelimion@users.noreply.github.com>2024-08-17 17:25:52 +0200
commit9553bc3689583158d044c82a3fd75248114f2291 (patch)
treed172f57b6e75bd6d24a60331e771b5ae64c82887 /src/parser.cpp
parentebbb70f11d0fdbe67a15976d2a1be1e2389493fa (diff)
If missing type is newline, print "newline", not \n
Turns: W:/Odin/bug/bug.odin(3:27) Syntax Error: Expected a type, got ' ' Storage :: distinct map[] Into: W:/Odin/bug/bug.odin(3:27) Syntax Error: Expected a type, got newline Storage :: distinct map[]
Diffstat (limited to 'src/parser.cpp')
-rw-r--r--src/parser.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/parser.cpp b/src/parser.cpp
index aba2b8276..5796012d9 100644
--- a/src/parser.cpp
+++ b/src/parser.cpp
@@ -3560,7 +3560,12 @@ gb_internal Ast *parse_type(AstFile *f) {
} else {
token = advance_token(f);
}
- syntax_error(token, "Expected a type, got '%.*s'", LIT(prev_token.string));
+ String prev_token_str = prev_token.string;
+ if (prev_token_str == str_lit("\n")) {
+ syntax_error(token, "Expected a type, got newline");
+ } else {
+ syntax_error(token, "Expected a type, got '%.*s'", LIT(prev_token_str));
+ }
return ast_bad_expr(f, token, f->curr_token);
} else if (type->kind == Ast_ParenExpr &&
unparen_expr(type) == nullptr) {