| ... | ... | @@ -1158,10 +1158,6 @@ static AstNode *ast_parse_prefix_expr(ParseContext *pc) { |
| 1158 | 1158 | // / Block |
| 1159 | 1159 | // / CurlySuffixExpr |
| 1160 | 1160 | static AstNode *ast_parse_primary_expr(ParseContext *pc) { |
| 1161 | | AstNode *enum_lit = ast_parse_enum_lit(pc); |
| 1162 | | if (enum_lit != nullptr) |
| 1163 | | return enum_lit; |
| 1164 | | |
| 1165 | 1161 | AstNode *asm_expr = ast_parse_asm_expr(pc); |
| 1166 | 1162 | if (asm_expr != nullptr) |
| 1167 | 1163 | return asm_expr; |
| ... | ... | @@ -1496,6 +1492,7 @@ static AstNode *ast_parse_suffix_expr(ParseContext *pc) { |
| 1496 | 1492 | // <- BUILTINIDENTIFIER FnCallArguments |
| 1497 | 1493 | // / CHAR_LITERAL |
| 1498 | 1494 | // / ContainerDecl |
| 1495 | // / DOT IDENTIFIER |
| 1499 | 1496 | // / ErrorSetDecl |
| 1500 | 1497 | // / FLOAT |
| 1501 | 1498 | // / FnProto |
| ... | ... | @@ -1556,6 +1553,10 @@ static AstNode *ast_parse_primary_type_expr(ParseContext *pc) { |
| 1556 | 1553 | if (container_decl != nullptr) |
| 1557 | 1554 | return container_decl; |
| 1558 | 1555 | |
| 1556 | AstNode *enum_lit = ast_parse_enum_lit(pc); |
| 1557 | if (enum_lit != nullptr) |
| 1558 | return enum_lit; |
| 1559 | |
| 1559 | 1560 | AstNode *error_set_decl = ast_parse_error_set_decl(pc); |
| 1560 | 1561 | if (error_set_decl != nullptr) |
| 1561 | 1562 | return error_set_decl; |
| ... | ... | @@ -1958,7 +1959,14 @@ static AstNode *ast_parse_field_init(ParseContext *pc) { |
| 1958 | 1959 | return nullptr; |
| 1959 | 1960 | |
| 1960 | 1961 | Token *name = expect_token(pc, TokenIdSymbol); |
| 1961 | | expect_token(pc, TokenIdEq); |
| 1962 | if (eat_token_if(pc, TokenIdEq) == nullptr) { |
| 1963 | // Because ".Name" can also be intepreted as an enum literal, we should put back |
| 1964 | // those two tokens again so that the parser can try to parse them as the enum |
| 1965 | // literal later. |
| 1966 | put_back_token(pc); |
| 1967 | put_back_token(pc); |
| 1968 | return nullptr; |
| 1969 | } |
| 1962 | 1970 | AstNode *expr = ast_expect(pc, ast_parse_expr); |
| 1963 | 1971 | |
| 1964 | 1972 | AstNode *res = ast_create_node(pc, NodeTypeStructValueField, first); |