Skip to content

Conversation

@sebastien-marichal
Copy link

comment was incorrectly including the \r character on file using CRLF (Windows).

This change updates the regex in the comment rule to exclude both \r and \n, changing the match pattern from /#.*/ to /#[^\r\n]*/.

I was not able to add a test in corpus. I tried to use the :cst attribute with no avail so I could assert node length.


Given the following file (with CRLF):

# test comment

Here the previous parse value:

0:0  - 1:0    program
0:0  - 0:15     comment `# test comment\r`

Now with the fix:

0:0  - 1:0    program
0:0  - 0:14     comment `# test comment`

Command used for the output: tree-sitter.exe parse --cst .\test.crlf.sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant