diff options
| author | gingerBill <bill@gingerbill.org> | 2024-02-22 18:52:17 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2024-02-22 18:52:17 +0000 |
| commit | 980947b3556ac4583599ff1864824bcac39c0aa5 (patch) | |
| tree | 555484f311c786450c33c11206d9cfb482e674d6 /src/parser.cpp | |
| parent | fd987b29ff670e6dd7c33c1682927f7bc9c47ef6 (diff) | |
Give a better error message when the user uses `context` as if it was an identifier in a field list.
Diffstat (limited to 'src/parser.cpp')
| -rw-r--r-- | src/parser.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/parser.cpp b/src/parser.cpp index 70da9414d..31d41a511 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -4001,6 +4001,10 @@ gb_internal Array<Ast *> convert_to_ident_list(AstFile *f, Array<AstAndFlags> li case Ast_Ident: case Ast_BadExpr: break; + case Ast_Implicit: + syntax_error(ident, "Expected an identifier, '%.*s' which is a keyword", LIT(ident->Implicit.string)); + ident = ast_ident(f, blank_token); + break; case Ast_PolyType: if (allow_poly_names) { @@ -4014,8 +4018,9 @@ gb_internal Array<Ast *> convert_to_ident_list(AstFile *f, Array<AstAndFlags> li } /*fallthrough*/ + default: - syntax_error(ident, "Expected an identifier"); + syntax_error(ident, "Expected an identifier, %d", ident->kind); ident = ast_ident(f, blank_token); break; } |