Skip to content

funccall always parsed instead of funcdef because its shorter #28

@travisstaloch

Description

@travisstaloch

Hello and thank you for this great library. I'm trying to parse a language with fat arrow funcdefs as in:

a() => 1

However, they are never begin used because funccall is a shorter version of this:

a()

I've verified they both work as removing funccall allows funcdef to work again. Is there any way to set precedence or otherwise allow funcdef to be used? Thanks for any advice or feedback.

Here are the relevent parser definitions:

arglist = (name | (name + E","))[0:end]
funccall = name + E"(" + arglist + E")" |> FuncCall

paramlist = ((name | assign) | ((name | assign) + E","))[0:end]
funcbody = stmt | (whitespacereq + stmt)[1:end]
funcdef = name + E"(" + paramlist + E")" + E"=>" + E"\n"[0:end] + funcbody |> FuncDef

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions