Parse empty argument list in function call

This commit is contained in:
Alexander Luzgarev 2018-04-01 17:00:25 +02:00
parent 7d881d7f4a
commit 52a85be26c

View File

@ -250,11 +250,14 @@ namespace Parser
private FunctionCallParameterListNode ParseFunctionCallParameterList() private FunctionCallParameterListNode ParseFunctionCallParameterList()
{ {
var first = ParseExpression(); var nodes = new List<SyntaxNode>();
var nodes = new List<SyntaxNode> { first }; while (CurrentToken.Kind != TokenKind.ClosingBracket)
while (CurrentToken.PureToken.Kind != TokenKind.ClosingBracket)
{ {
nodes.Add(Factory.Token(EatToken(TokenKind.Comma))); if (nodes.Count > 0)
{
nodes.Add(Factory.Token(EatToken(TokenKind.Comma)));
}
nodes.Add(ParseExpression()); nodes.Add(ParseExpression());
} }