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

Spaces in parameter initialization leads to error

Open madskjeldgaard opened this issue 3 years ago • 1 comments

Adding whitespace between the argument name and the value it is initialized to leads to parsing errors:

NiceNice{
  *new{| so = \hej|}
}

Parses as:

(source_file [0, 0] - [3, 0]
  (class_def [0, 0] - [2, 1]
    (class [0, 0] - [0, 8])
    (class_method_name [1, 3] - [1, 6])
    (function_block [1, 6] - [1, 20]
      (parameter_list [1, 7] - [1, 19]
        (argument [1, 9] - [1, 11]
          name: (identifier [1, 9] - [1, 11]))
        (ERROR [1, 12] - [1, 15])
        (argument [1, 15] - [1, 18]
          name: (identifier [1, 15] - [1, 18]))))))

vs this which parses okay:

NiceNice{
  *new{| so=\hej|}
}

as:

(source_file [0, 0] - [3, 0]
  (class_def [0, 0] - [2, 1]
    (class [0, 0] - [0, 8])
    (class_method_name [1, 3] - [1, 6])
    (function_block [1, 6] - [1, 18]
      (parameter_list [1, 7] - [1, 17]
        (argument [1, 9] - [1, 16]
          name: (identifier [1, 9] - [1, 11])
          value: (literal [1, 12] - [1, 16]
            (symbol [1, 12] - [1, 16]
              (identifier [1, 13] - [1, 16]))))))))

madskjeldgaard avatar Feb 01 '22 12:02 madskjeldgaard

More info here: https://github.com/tree-sitter/tree-sitter/discussions/1633

madskjeldgaard avatar Feb 01 '22 15:02 madskjeldgaard