lang: ast, parser: Allow calling anonymous functions

I forgot to plumb this in through the parser. Pretty easy to add,
hopefully I didn't forget any weird corner scope cases here.
This commit is contained in:
James Shubin
2025-01-08 23:06:51 -05:00
parent 1af334f2ce
commit 1538befc93
6 changed files with 138 additions and 2 deletions

View File

@@ -566,6 +566,16 @@ call:
Var: true, // lambda
}
}
// calling an inline function
| func OPEN_PAREN call_args CLOSE_PAREN
{
posLast(yylex, yyDollar) // our pos
$$.expr = &ast.ExprCall{
Name: "", // anonymous!
Args: $3.exprs,
Anon: $1.expr,
}
}
| expr PLUS expr
{
posLast(yylex, yyDollar) // our pos