diff --git a/app/main/parser.cpp b/app/main/parser.cpp index 7526025c..6be943cd 100644 --- a/app/main/parser.cpp +++ b/app/main/parser.cpp @@ -76,12 +76,17 @@ SyntaxNode* Parser::Parse() delete result; } - result = new ErrorNode(lexer->GetInput(), token->GetPos()); - if (block != NOMEM) { - block->Add(result); + if (block == NOMEM) { + block = new StatementBlockNode(); } - GetToken(); + result = new ErrorNode(lexer->GetInput(), token->GetPos()); + block->Add(result); + + // Skip until next statement + do { + GetToken(); + } while (token->symbol != symdelimiter && token->symbol != symend); } current = token;