diff options
| author | gingerBill <bill@gingerbill.org> | 2024-06-10 14:18:33 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2024-06-10 14:18:33 +0100 |
| commit | 1945218f6df814ea95233035d0b51585e2522b2e (patch) | |
| tree | 4d2934828f796f862c3d7656d045fb518dd8f83c /src/parser.cpp | |
| parent | bedeaa34d95b769524980db7c8eb3cae9a54d6d9 (diff) | |
Improve parsing for `label: #reverse for` and `label: #partial switch`
Diffstat (limited to 'src/parser.cpp')
| -rw-r--r-- | src/parser.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/parser.cpp b/src/parser.cpp index eff5e0c6c..2cdcea417 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -3747,8 +3747,10 @@ gb_internal Ast *parse_simple_stmt(AstFile *f, u32 flags) { case Ast_TypeSwitchStmt: stmt->TypeSwitchStmt.partial = true; break; + default: + syntax_error(partial_token, "Incorrect use of directive, use '%.*s: #partial switch'", LIT(ast_token(name).string)); + break; } - syntax_error(partial_token, "Incorrect use of directive, use '#partial %.*s: switch'", LIT(ast_token(name).string)); } else if (is_reverse) { switch (stmt->kind) { case Ast_RangeStmt: @@ -5176,7 +5178,7 @@ gb_internal Ast *parse_stmt(AstFile *f) { } else if (tag == "unroll") { return parse_unrolled_for_loop(f, name); } else if (tag == "reverse") { - Ast *for_stmt = parse_for_stmt(f); + Ast *for_stmt = parse_stmt(f); if (for_stmt->kind == Ast_RangeStmt) { if (for_stmt->RangeStmt.reverse) { syntax_error(token, "#reverse already applied to a 'for in' statement"); |