diff options
| author | gingerBill <bill@gingerbill.org> | 2018-12-15 21:46:27 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2018-12-15 21:46:27 +0000 |
| commit | 1ce90b2166747d374e140f2d7cad0a5749fbb11d (patch) | |
| tree | 6be092c27592e6f6268b935a8baaece7ae7eb529 /src/parser.cpp | |
| parent | 9d6666f333cd427a720c639ee0b9b513d79fe8a0 (diff) | |
Remove weird bit_set shorthand; Add extra type hinting
Diffstat (limited to 'src/parser.cpp')
| -rw-r--r-- | src/parser.cpp | 35 |
1 files changed, 12 insertions, 23 deletions
diff --git a/src/parser.cpp b/src/parser.cpp index f42cfaa32..1942ea2ad 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -2078,32 +2078,21 @@ Ast *parse_operand(AstFile *f, bool lhs) { case Token_bit_set: { Token token = expect_token(f, Token_bit_set); + expect_token(f, Token_OpenBracket); - if (f->curr_token.kind == Token_OpenBrace) { - Token open = expect_token(f, Token_OpenBrace); - - Array<Ast *> values = parse_element_list(f); - Token close = expect_token(f, Token_CloseBrace); - Ast *enum_type = ast_enum_type(f, token, nullptr, values); - - return ast_bit_set_type(f, token, enum_type, nullptr); - } else { - expect_token(f, Token_OpenBracket); - - Ast *elem = nullptr; - Ast *underlying = nullptr; + Ast *elem = nullptr; + Ast *underlying = nullptr; - bool prev_allow_range = f->allow_range; - f->allow_range = true; - elem = parse_expr(f, false); - f->allow_range = prev_allow_range; - if (allow_token(f, Token_Semicolon)) { - underlying = parse_type(f); - } - - expect_token(f, Token_CloseBracket); - return ast_bit_set_type(f, token, elem, underlying); + bool prev_allow_range = f->allow_range; + f->allow_range = true; + elem = parse_expr(f, false); + f->allow_range = prev_allow_range; + if (allow_token(f, Token_Semicolon)) { + underlying = parse_type(f); } + + expect_token(f, Token_CloseBracket); + return ast_bit_set_type(f, token, elem, underlying); } default: { |