| ... | @@ -81,7 +81,7 @@ static AstNode *ast_parse_for_type_expr(ParseContext *pc); | ... | @@ -81,7 +81,7 @@ static AstNode *ast_parse_for_type_expr(ParseContext *pc); |
| 81 | static AstNode *ast_parse_while_type_expr(ParseContext *pc); | 81 | static AstNode *ast_parse_while_type_expr(ParseContext *pc); |
| 82 | static AstNode *ast_parse_switch_expr(ParseContext *pc); | 82 | static AstNode *ast_parse_switch_expr(ParseContext *pc); |
| 83 | static AstNode *ast_parse_asm_expr(ParseContext *pc); | 83 | static AstNode *ast_parse_asm_expr(ParseContext *pc); |
| 84 | static AstNode *ast_parse_enum_lit(ParseContext *pc); | 84 | static AstNode *ast_parse_anon_lit(ParseContext *pc); |
| 85 | static AstNode *ast_parse_asm_output(ParseContext *pc); | 85 | static AstNode *ast_parse_asm_output(ParseContext *pc); |
| 86 | static AsmOutput *ast_parse_asm_output_item(ParseContext *pc); | 86 | static AsmOutput *ast_parse_asm_output_item(ParseContext *pc); |
| 87 | static AstNode *ast_parse_asm_input(ParseContext *pc); | 87 | static AstNode *ast_parse_asm_input(ParseContext *pc); |
| ... | @@ -1600,9 +1600,9 @@ static AstNode *ast_parse_primary_type_expr(ParseContext *pc) { | ... | @@ -1600,9 +1600,9 @@ static AstNode *ast_parse_primary_type_expr(ParseContext *pc) { |
| 1600 | if (container_decl != nullptr) | 1600 | if (container_decl != nullptr) |
| 1601 | return container_decl; | 1601 | return container_decl; |
| 1602 | | 1602 | |
| 1603 | AstNode *enum_lit = ast_parse_enum_lit(pc); | 1603 | AstNode *anon_lit = ast_parse_anon_lit(pc); |
| 1604 | if (enum_lit != nullptr) | 1604 | if (anon_lit != nullptr) |
| 1605 | return enum_lit; | 1605 | return anon_lit; |
| 1606 | | 1606 | |
| 1607 | AstNode *error_set_decl = ast_parse_error_set_decl(pc); | 1607 | AstNode *error_set_decl = ast_parse_error_set_decl(pc); |
| 1608 | if (error_set_decl != nullptr) | 1608 | if (error_set_decl != nullptr) |
| ... | @@ -1876,16 +1876,22 @@ static AstNode *ast_parse_asm_expr(ParseContext *pc) { | ... | @@ -1876,16 +1876,22 @@ static AstNode *ast_parse_asm_expr(ParseContext *pc) { |
| 1876 | return res; | 1876 | return res; |
| 1877 | } | 1877 | } |
| 1878 | | 1878 | |
| 1879 | static AstNode *ast_parse_enum_lit(ParseContext *pc) { | 1879 | static AstNode *ast_parse_anon_lit(ParseContext *pc) { |
| 1880 | Token *period = eat_token_if(pc, TokenIdDot); | 1880 | Token *period = eat_token_if(pc, TokenIdDot); |
| 1881 | if (period == nullptr) | 1881 | if (period == nullptr) |
| 1882 | return nullptr; | 1882 | return nullptr; |
| 1883 | | 1883 | |
| 1884 | Token *identifier = expect_token(pc, TokenIdSymbol); | 1884 | // anon enum literal |
| 1885 | AstNode *res = ast_create_node(pc, NodeTypeEnumLiteral, period); | 1885 | Token *identifier = eat_token_if(pc, TokenIdSymbol); |
| 1886 | res->data.enum_literal.period = period; | 1886 | if (identifier != nullptr) { |
| 1887 | res->data.enum_literal.identifier = identifier; | 1887 | AstNode *res = ast_create_node(pc, NodeTypeEnumLiteral, period); |
| 1888 | return res; | 1888 | res->data.enum_literal.period = period; |
| | 1889 | res->data.enum_literal.identifier = identifier; |
| | 1890 | return res; |
| | 1891 | } |
| | 1892 | |
| | 1893 | // anon container literal |
| | 1894 | return ast_parse_init_list(pc); |
| 1889 | } | 1895 | } |
| 1890 | | 1896 | |
| 1891 | // AsmOutput <- COLON AsmOutputList AsmInput? | 1897 | // AsmOutput <- COLON AsmOutputList AsmInput? |