Parse extra semicolons as empty statements

This commit is contained in:
Alexander Luzgarev 2018-04-04 12:11:50 +02:00
parent a2ef543292
commit d78e5d671e

View File

@ -873,6 +873,11 @@ namespace Parser
{ {
return ParseExpressionStatement(); return ParseExpressionStatement();
} }
if (CurrentToken.Kind == TokenKind.Semicolon)
{
return Factory.ExpressionStatement(Factory.EmptyExpression(), Factory.Token(EatToken()));
}
throw new ParsingException($"Unexpected token: \"{CurrentToken.PureToken}\" at {CurrentToken.PureToken.Position}"); throw new ParsingException($"Unexpected token: \"{CurrentToken.PureToken}\" at {CurrentToken.PureToken.Position}");
} }