Handle empty call

This commit is contained in:
Rafał Grodziński
2025-07-05 20:29:29 +09:00
parent da1b5852ff
commit 1e7ecaf801

View File

@@ -501,6 +501,7 @@ shared_ptr<Expression> Parser::matchExpressionCall() {
currentIndex++; // left parenthesis
vector<shared_ptr<Expression>> argumentExpressions;
if (!tryMatchingTokenKinds({TokenKind::RIGHT_PAREN}, true, true)) {
do {
tryMatchingTokenKinds({TokenKind::NEW_LINE}, true, true); // optional new line
@@ -515,6 +516,7 @@ shared_ptr<Expression> Parser::matchExpressionCall() {
markError(TokenKind::RIGHT_PAREN, {});
return nullptr;
}
}
return make_shared<ExpressionCall>(identifierToken->getLexme(), argumentExpressions);
}