bug: First-line inner attribute item is regarded as shebang
monaqa opened this issue · comments
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-rust
Tree-Sitter CLI Version, if relevant (output of tree-sitter --version
)
tree-sitter 0.20.8
Describe the bug
If the first (non-blank / non-comment) line starts with #!
, even if it should be parsed as an inner_attribute_item, it is regarded as a shebang.
Steps To Reproduce/Bad Parse Tree
(source_file [0, 0] - [3, 0]
(shebang [0, 0] - [0, 27])
(function_item [2, 0] - [2, 12]
name: (identifier [2, 3] - [2, 7])
parameters: (parameters [2, 7] - [2, 9])
body: (block [2, 10] - [2, 12])))
Expected Behavior/Parse Tree
(source_file [0, 0] - [3, 0]
(inner_attribute_item [0, 0] - [0, 27]
(attribute [0, 3] - [0, 26]
(identifier [0, 3] - [0, 8])
arguments: (token_tree [0, 8] - [0, 26]
(identifier [0, 9] - [0, 25]))))
(function_item [2, 0] - [2, 12]
name: (identifier [2, 3] - [2, 7])
parameters: (parameters [2, 7] - [2, 9])
body: (block [2, 10] - [2, 12])))
Repro
#![allow(unused_variables)]
fn main() {}
Thanks, fixed on master
Thanks for the quick fix!