pipes end expressions

This commit is contained in:
Chris Wanstrath 2025-11-25 16:53:17 -08:00 committed by Chris Wanstrath
parent ae9896c8a2
commit 1ea130f8e0

View File

@ -123,7 +123,7 @@ export class Parser {
// check for parens function call // check for parens function call
// ex: (ref my-func) my-arg // 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) expr = this.functionCall(expr)
// if dotget is followed by binary operator, continue parsing as binary expression // 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 ident = fn ?? this.identifier()
const args: SyntaxNode[] = [] const args: SyntaxNode[] = []
while (!this.isExprEnd() && !this.is($T.Operator, '|')) while (!this.isExprEnd())
args.push(this.is($T.NamedArgPrefix) ? this.namedArg() : this.arg()) args.push(this.is($T.NamedArgPrefix) ? this.namedArg() : this.arg())
const node = new SyntaxNode('FunctionCall', ident.from, (args.at(-1) || ident).to) const node = new SyntaxNode('FunctionCall', ident.from, (args.at(-1) || ident).to)
@ -869,6 +869,7 @@ export class Parser {
isExprEnd(): boolean { isExprEnd(): boolean {
return this.isAny($T.Colon, $T.Semicolon, $T.Newline, $T.CloseParen, $T.CloseBracket) || return this.isAny($T.Colon, $T.Semicolon, $T.Newline, $T.CloseParen, $T.CloseBracket) ||
this.is($T.Operator, '|') ||
this.isExprEndKeyword() || !this.current() this.isExprEndKeyword() || !this.current()
} }