From 848b9f198790e9e15dffeb52a57d7f2ebd9df9f5 Mon Sep 17 00:00:00 2001 From: Carsten Larsen Date: Sat, 28 Jan 2017 22:04:35 +0100 Subject: [PATCH] Improve error handling --- app/main/parser.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) 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;