-
Notifications
You must be signed in to change notification settings - Fork 58
Open
Labels
Description
Did you check existing issues?
- I have read all the tree-sitter docs if it relates to using the parser
- I have searched the existing issues of tree-sitter-c
Tree-Sitter CLI Version, if relevant (output of tree-sitter --version
)
tree-sitter = "0.20.6", tree-sitter-ruby = "0.20.1"
Describe the bug
When using string concatenation without any spaces using <<
operator it looks like it is mistaking it for a heredoc string.
Steps To Reproduce/Bad Parse Tree
Using the ruby code
"test"<<"ruby"
Generates the following tree
program [0, 0] - [1, 0]
string [0, 0] - [0, 6]
string_content [0, 1] - [0, 5]
MISSING ; [0, 6] - [0, 6]
heredoc_beginning [0, 6] - [0, 14]
heredoc_body [0, 14] - [1, 0]
heredoc_content [0, 14] - [1, 0]
heredoc_end [1, 0] - [1, 0]
Here the string followed by <<
is considered as a heredoc but this code evaluates to "testruby". When I add a space after the <<
I get the below tree which is what I'm looking for.
for code
"test"<< "ruby"
This is the tree
program [0, 0] - [1, 0]
binary [0, 0] - [0, 15]
left: string [0, 0] - [0, 6]
string_content [0, 1] - [0, 5]
right: string [0, 9] - [0, 15]
string_content [0, 10] - [0, 14]
Expected Behavior/Parse Tree
Tree with spaces
This is the tree
program [0, 0] - [1, 0]
binary [0, 0] - [0, 15]
left: string [0, 0] - [0, 6]
string_content [0, 1] - [0, 5]
right: string [0, 9] - [0, 15]
string_content [0, 10] - [0, 14]
Repro
No response