-
Notifications
You must be signed in to change notification settings - Fork 73
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.25.10 (da6fe9beb4f7f67beb75914ca8e0d48ae48d6406)
Describe the bug
When a function receives an anonymous block and forward it to another function without surrounding arguments with parenthesis the generated parsed tree presents an error, however it works fine if the block is named, or the arguments are surrounded by parenthesis.
def ok_with_named_block(x, &a)
bar x, &a
end
def ok_anonymous_surrounded(x, &)
bar(x, &)
end
def error_anonymous_not_surrounded(x, &)
bar x, &
endSteps To Reproduce/Bad Parse Tree
(program [0, 0] - [3, 0]
(method [0, 0] - [2, 3]
name: (identifier [0, 4] - [0, 7])
parameters: (method_parameters [0, 7] - [0, 13]
(identifier [0, 8] - [0, 9])
(block_parameter [0, 11] - [0, 12]))
body: (body_statement [1, 2] - [1, 10]
(call [1, 2] - [1, 7]
method: (identifier [1, 2] - [1, 5])
arguments: (argument_list [1, 6] - [1, 7]
(identifier [1, 6] - [1, 7])))
(ERROR [1, 7] - [1, 10]))))
Expected Behavior/Parse Tree
(program [0, 0] - [3, 0]
(method [0, 0] - [2, 3]
name: (identifier [0, 4] - [0, 7])
parameters: (method_parameters [0, 7] - [0, 13]
(identifier [0, 8] - [0, 9])
(block_parameter [0, 11] - [0, 12]))
body: (body_statement [1, 2] - [1, 11]
(call [1, 2] - [1, 11]
method: (identifier [1, 2] - [1, 5])
arguments: (argument_list [1, 5] - [1, 11]
(identifier [1, 6] - [1, 7])
(block_argument [1, 9] - [1, 10]))))))
Repro
def foo(x, &)
bar x, &
endReactions are currently unavailable