tree-sitter / tree-sitter-scala

Scala grammar for tree-sitter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`for` with multiline expression enumerator

susliko opened this issue · comments

Commit of tree-sitter-scala you tested this on

59ab070

A code sample showing the error

for 
  _ <- a *>
       b
yield ()

Show the error node

(compilation_unit [0, 0] - [4, 0]
  (ERROR [0, 0] - [4, 0]
    (enumerators [1, 2] - [4, 0]
      (enumerator [1, 2] - [1, 11]
        (wildcard [1, 2] - [1, 3])
        (postfix_expression [1, 7] - [1, 11]
          (identifier [1, 7] - [1, 8])
          (operator_identifier [1, 9] - [1, 11])))
      (ERROR [2, 7] - [3, 8]
        (infix_pattern [2, 7] - [3, 8]
          left: (identifier [2, 7] - [2, 8])
          operator: (identifier [3, 0] - [3, 5])
          right: (tuple_pattern [3, 6] - [3, 8]
            (identifier [3, 7] - [3, 7])))))))

What do you expect the tree to look like

(compilation_unit [0, 0] - [3, 0]
  (for_expression [0, 0] - [2, 8]
    enumerators: (enumerators [1, 2] - [2, 0]
      (enumerator [1, 2] - [1, 13]
        (wildcard [1, 2] - [1, 3])
        (infix_expression [1, 7] - [1, 13]
          left: (identifier [1, 7] - [1, 8])
          operator: (operator_identifier [1, 9] - [1, 11])
          right: (identifier [1, 12] - [1, 13]))))
    body: (unit [2, 6] - [2, 8])))

Where are you experiencing this error?

vanilla tree-sitter