Original file line numberDiff line numberDiff line change
Expand Up@@ -549,6 +549,10 @@ func (p *parser) parseCall(token Token, arguments []Node, checkOverrides bool) N
arguments = append(arguments, node)
}

// skip last comma
if p.current.Is(Operator, ",") {
p.next()
}
p.expect(Bracket, ")")

node = p.createNode(&BuiltinNode{
Expand DownExpand Up@@ -593,6 +597,9 @@ func (p *parser) parseArguments(arguments []Node) []Node {
if len(arguments) > offset {
p.expect(Operator, ",")
}
if p.current.Is(Bracket, ")") {
break
}
node := p.parseExpression(0)
arguments = append(arguments, node)
}
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -839,6 +839,42 @@ world`},
Expr: &IdentifierNode{Value: "x"},
},
},
{
`all(
[
true,
false,
],
#,
)`,
&BuiltinNode{
Name: "all",
Arguments: []Node{
&ArrayNode{
Nodes: []Node{
&BoolNode{Value: true},
&BoolNode{Value: false},
},
},
&PredicateNode{
Node: &PointerNode{},
},
},
},
},
{
`func(
parameter1,
parameter2,
)`,
&CallNode{
Callee: &IdentifierNode{Value: "func"},
Arguments: []Node{
&IdentifierNode{Value: "parameter1"},
&IdentifierNode{Value: "parameter2"},
},
},
},
}
for _, test := range tests {
t.Run(test.input, func(t *testing.T) {
Expand Down
Loading