Empty function call borks
Closed this issue · 1 comments
vihanb commented
A parser error is thrown for )
when you do:
f()
or any other variation with no arguments
taylorhansen commented
I took a look at how function calls are parsed and here are the related rules:
FunctionCallList
-> delimited[FunctionCallArgument {% id %}, _ "," _] {%
(data, location) => new t.FunctionCall(null, data[0], location)
%}
FunctionCallArgument
-> %identifier _ ":" _ Expression {%
(data, location) => new t.ArgumentCall(data[4], data[0], location)
%}
| Expression {%
(data, location) => new t.ArgumentCall(data[0], null, location)
%}
Nearley's builtin delimited
macro is defined as:
delimited[el, delim] -> $el ($delim $el {% nth(1) %}):* {%
function(d) {
return [d[0]].concat(d[1]);
}
%}
Which requires at least one $el
.