Skip to content
This repository was archived by the owner on May 5, 2023. It is now read-only.
This repository was archived by the owner on May 5, 2023. It is now read-only.

Support for method call syntax in call expressions #139

@ad-chaos

Description

@ad-chaos

Currently doing something like

call GetThing()->takething()

is broken, it generates the following syntax tree

call_statement [0, 0] - [0, 15]
  call_expression [0, 5] - [0, 15]
    function: identifier [0, 5] - [0, 13]
ERROR [0, 15] - [0, 28]
  keyword [0, 17] - [0, 26]

I tried fixing it by defining call_expression as the following:

call_expression: ($) =>
  prec(
    PREC.CALL,
    sep1(
      seq(
        field("function", $._expression),
        "(",
        commaSep($._expression),
        ")"
      ),
     "->"
    )
  ),

But that seems to only recognises two calls like call foo()->bar() and not the ones after it in call foo()->bar()->baz()
->baz() shows up as an ERROR node.

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