From 7d881d7f4abf763b25aad94ec8fa7136f7d3a183 Mon Sep 17 00:00:00 2001 From: Alexander Luzgarev Date: Sun, 1 Apr 2018 16:47:04 +0200 Subject: [PATCH] Parse empty argument list in function description --- Parser/MParser.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Parser/MParser.cs b/Parser/MParser.cs index 6dec931..94ff0f1 100644 --- a/Parser/MParser.cs +++ b/Parser/MParser.cs @@ -173,10 +173,14 @@ namespace Parser private ParameterListNode ParseParameterList() { var identifierTokens = new List(); - identifierTokens.Add(EatToken(TokenKind.Identifier)); - while (CurrentToken.PureToken.Kind != TokenKind.ClosingBracket) + + while (CurrentToken.Kind != TokenKind.ClosingBracket) { - identifierTokens.Add(EatToken(TokenKind.Comma)); + if (identifierTokens.Count > 0) + { + identifierTokens.Add(EatToken(TokenKind.Comma)); + } + identifierTokens.Add(EatToken(TokenKind.Identifier)); }