in packages/core/nano/src/parser.ts [760:799]
function parseArgumentList(): R[] {
const list: R[] = [];
let nextArgPos = scanner.getWSTokenPos();
let freshArgument = true;
while (true) {
if (isStartOfExpression(currentToken)) {
// Only parse out an expected comma when we have
// already parsed an expression for this argument
// position and we come across another expression.
// This assumes that a comma is not a valid start of
// expression.
if (!freshArgument) {
parseExpected(SyntaxKind.CommaToken);
}
list.push(parseExpression());
freshArgument = parseOptional(SyntaxKind.CommaToken);
if (freshArgument) {
nextArgPos = scanner.getWSTokenPos();
}
continue;
}
if (isListEnd()) {
break;
}
if (parseOptional(SyntaxKind.CommaToken)) {
if (freshArgument) {
list.push(algebra.missing(nextArgPos, algContext));
}
freshArgument = true;
nextArgPos = scanner.getWSTokenPos();
continue;
}
nextToken();
}
if (freshArgument && list.length > 0) {
list.push(algebra.missing(nextArgPos, algContext));
}
parseExpected(SyntaxKind.CloseParenToken);
return list;
}