aboutsummaryrefslogtreecommitdiff
path: root/src/parser.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2024-03-27 13:05:15 +0000
committergingerBill <bill@gingerbill.org>2024-03-27 13:05:15 +0000
commit12ec9bce7d5ba87452f6a23b35ad7e5e78012ec9 (patch)
tree6af9e08bcc01639c812eb86114eb7f314c002daf /src/parser.cpp
parentb378eb2df39c9d73c383e430321e49d48c4fb17c (diff)
Fix parsing bug on `bit_set[;x]`
Diffstat (limited to 'src/parser.cpp')
-rw-r--r--src/parser.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/parser.cpp b/src/parser.cpp
index d46079964..747677946 100644
--- a/src/parser.cpp
+++ b/src/parser.cpp
@@ -2885,6 +2885,10 @@ gb_internal Ast *parse_operand(AstFile *f, bool lhs) {
elem = parse_expr(f, true);
f->allow_range = prev_allow_range;
+ if (elem == nullptr) {
+ syntax_error(token, "Expected a type or range, got nothing");
+ }
+
if (allow_token(f, Token_Semicolon)) {
underlying = parse_type(f);
} else if (allow_token(f, Token_Comma)) {
@@ -2894,6 +2898,7 @@ gb_internal Ast *parse_operand(AstFile *f, bool lhs) {
underlying = parse_type(f);
}
+
expect_token(f, Token_CloseBracket);
return ast_bit_set_type(f, token, elem, underlying);
}