elm-tooling / tree-sitter-elm

Tree sitter implementation for elm
https://elm-tooling.github.io/tree-sitter-elm/
MIT License
74 stars 12 forks source link

Comment newlines are preserved in CRLF files #133

Open Wilfred opened 2 years ago

Wilfred commented 2 years ago

Given the file foo.elm:

-- stuff
x = 1

Convert to CRLF line endings:

$ unix2dos foo.elm

And dump the parse tree:

file (0, 0) - (2, 0)
  line_comment (0, 0) - (0, 9) "-- stuff\r"
  value_declaration (1, 0) - (1, 5)
    function_declaration_left (1, 0) - (1, 1)
      lower_case_identifier (1, 0) - (1, 1) "x"
    eq (1, 2) - (1, 3) "="
    number_constant_expr (1, 4) - (1, 5)
      number_literal (1, 4) - (1, 5) "1"

Note the unwanted "\r" in the line_comment.