diff options
| author | gingerBill <bill@gingerbill.org> | 2021-08-03 15:46:14 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2021-08-03 15:46:14 +0100 |
| commit | c3e4509d17ef319bb8c66f00afc17e9169f21e85 (patch) | |
| tree | 1555710b769c89b2036a54fb4b50878603e4bd68 /src/parser.cpp | |
| parent | 664be28941e786c351c5bf2c2d12547019dec1c2 (diff) | |
Improve error message when using a comma rather than a semicolon in a `bit_set`
Diffstat (limited to 'src/parser.cpp')
| -rw-r--r-- | src/parser.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/parser.cpp b/src/parser.cpp index 694dce735..fbd6cf0f7 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -2428,8 +2428,14 @@ Ast *parse_operand(AstFile *f, bool lhs) { f->allow_range = true; elem = parse_expr(f, true); f->allow_range = prev_allow_range; + if (allow_token(f, Token_Semicolon)) { underlying = parse_type(f); + } else if (allow_token(f, Token_Comma)) { + String p = token_to_string(f->prev_token); + syntax_error(token_end_of_line(f, f->prev_token), "Expected a semicolon, got a %.*s", LIT(p)); + + underlying = parse_type(f); } expect_token(f, Token_CloseBracket); |