elm-tooling/tree-sitter-elm

Comment newlines are preserved in CRLF files

Wilfred opened this issue · 0 comments

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.