fix infinite loop with mismatced bracket

This commit is contained in:
Vexu
2020-05-15 23:38:40 +03:00
parent a00fd6e254
commit b2f16d4484
4 changed files with 24 additions and 11 deletions

View File

@@ -538,8 +538,8 @@ enum ContainerFieldState {
// <- TestDecl ContainerMembers
// / TopLevelComptime ContainerMembers
// / KEYWORD_pub? TopLevelDecl ContainerMembers
// / KEYWORD_comptime? ContainerField COMMA ContainerMembers
// / KEYWORD_comptime? ContainerField
// / ContainerField COMMA ContainerMembers
// / ContainerField
// /
static AstNodeContainerDecl ast_parse_container_members(ParseContext *pc) {
AstNodeContainerDecl res = {};
@@ -862,7 +862,7 @@ static AstNode *ast_parse_var_decl(ParseContext *pc) {
return res;
}
// ContainerField <- IDENTIFIER (COLON TypeExpr ByteAlign?)? (EQUAL Expr)?
// ContainerField <- KEYWORD_comptime? IDENTIFIER (COLON TypeExpr ByteAlign?)? (EQUAL Expr)?
static AstNode *ast_parse_container_field(ParseContext *pc) {
Token *identifier = eat_token_if(pc, TokenIdSymbol);
if (identifier == nullptr)