tree-sitter-viml icon indicating copy to clipboard operation
tree-sitter-viml copied to clipboard

Support for method call syntax in call expressions

Open ad-chaos opened this issue 2 years ago • 2 comments

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.

ad-chaos avatar Jan 27 '23 07:01 ad-chaos

Should be fixed by https://github.com/vigoux/tree-sitter-viml/pull/125.

clason avatar Jan 28 '23 12:01 clason

Ah, I must've missed it

ad-chaos avatar Jan 28 '23 17:01 ad-chaos