diff --git a/src/parser/parser2.ts b/src/parser/parser2.ts index 6244038..862f4b9 100644 --- a/src/parser/parser2.ts +++ b/src/parser/parser2.ts @@ -123,7 +123,7 @@ export class Parser { // check for parens function call // ex: (ref my-func) my-arg - if (expr.type.is('ParenExpr') && !this.isExprEnd() && !this.is($T.Operator, '|')) + if (expr.type.is('ParenExpr') && !this.isExprEnd()) expr = this.functionCall(expr) // if dotget is followed by binary operator, continue parsing as binary expression @@ -588,7 +588,7 @@ export class Parser { const ident = fn ?? this.identifier() const args: SyntaxNode[] = [] - while (!this.isExprEnd() && !this.is($T.Operator, '|')) + while (!this.isExprEnd()) args.push(this.is($T.NamedArgPrefix) ? this.namedArg() : this.arg()) const node = new SyntaxNode('FunctionCall', ident.from, (args.at(-1) || ident).to) @@ -869,6 +869,7 @@ export class Parser { isExprEnd(): boolean { return this.isAny($T.Colon, $T.Semicolon, $T.Newline, $T.CloseParen, $T.CloseBracket) || + this.is($T.Operator, '|') || this.isExprEndKeyword() || !this.current() }