From 9b3ad658df5cefe754c1fb11af9723de09ed1564 Mon Sep 17 00:00:00 2001 From: Christoph Mallon Date: Thu, 3 May 2012 18:22:04 +0200 Subject: [PATCH] Improve error recovery in parse_if() by adding T_else to the anchors earlier. Also remove the unnecessary anchor '{'. --- parser.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/parser.c b/parser.c index 9b6c138..a04e664 100644 --- a/parser.c +++ b/parser.c @@ -9231,7 +9231,7 @@ static statement_t *parse_if(void) PUSH_PARENT(statement); - add_anchor_token('{'); + add_anchor_token(T_else); expression_t *const expr = parse_condition(); statement->ifs.condition = expr; @@ -9239,9 +9239,6 @@ static statement_t *parse_if(void) * scalar type. */ semantic_condition(expr, "condition of 'if'-statment"); - rem_anchor_token('{'); - - add_anchor_token(T_else); statement_t *const true_stmt = parse_inner_statement(); statement->ifs.true_statement = true_stmt; rem_anchor_token(T_else); -- 2.20.1