-
-
Notifications
You must be signed in to change notification settings - Fork 169
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-python
Tree-Sitter CLI Version, if relevant (output of tree-sitter --version
)
tree-sitter 0.25.8 (f2f197b6b27ce75c280c20f131d4f71e906b86f7)
Describe the bug
The alias syntax in except clauses is already handled by except_clause
→ value
field → expression
→ as_pattern
, thus what follows after the value
field in except_clause
is redundant.
Steps To Reproduce/Bad Parse Tree
(module [0, 0] - [9, 0]
(try_statement [0, 0] - [3, 6]
body: (block [1, 2] - [1, 6]
(pass_statement [1, 2] - [1, 6]))
(except_clause [2, 0] - [3, 6]
value: (as_pattern [2, 7] - [2, 21]
(identifier [2, 7] - [2, 16])
alias: (as_pattern_target [2, 20] - [2, 21]
(identifier [2, 20] - [2, 21])))
(block [3, 2] - [3, 6]
(pass_statement [3, 2] - [3, 6]))))
(try_statement [5, 0] - [8, 6]
body: (block [6, 2] - [6, 6]
(pass_statement [6, 2] - [6, 6]))
(except_group_clause [7, 0] - [8, 6]
(as_pattern [7, 8] - [7, 22]
(identifier [7, 8] - [7, 17])
alias: (as_pattern_target [7, 21] - [7, 22]
(identifier [7, 21] - [7, 22])))
(block [8, 2] - [8, 6]
(pass_statement [8, 2] - [8, 6])))))
Expected Behavior/Parse Tree
The redundant as
syntax definition should either be removed or made to actually work.
Repro
try:
pass
except Exception as e:
pass
try:
pass
except* TypeError as e:
pass