-
-
Notifications
You must be signed in to change notification settings - Fork 169
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-python
Tree-Sitter CLI Version, if relevant (output of tree-sitter --version
)
No response
Describe the bug
When parsing valid Python code with , ERROR
nodes are unexpectedly generated. Specifically, in the provided example, the statement causes the parser to generate an ERROR
node, even though the syntax is fully valid Python. tree-sitter-python``print
- :
0.23.6
tree-sitter-python - Language binding: Rust (via crate)
tree-sitter
- OS: macOS
Steps To Reproduce/Bad Parse Tree
- Use the following Python code snippet as input:
def test(): print("hello")
- Use rust binding to parse it.
Node: source_file
Node text: def test():
print("hello")
Node: ERROR
Node text: def test():
print("hello")
Node: call_expression
Node text: print("hello")
Node: arguments
Node text: ("hello")
Node: )
Node text: )
Node: string_literal
Node text: "hello"
Node: "
Node text: "
Node: string_content
Node text: hello
Node: "
Node text: "
Node: (
Node text: (
Node: identifier
Node text: print
Node: ERROR
Node text: ):
Node: :
Node text: :
Node: )
Node text: )
Node: (
Node text: (
Node: identifier
Node text: test
Node: identifier
Node text: def
Expected Behavior/Parse Tree
Expected to parse the function successfully.
Repro
# Example code that causes the issue
def test():
# Code that fails to parse, or causes an error
print("hello")