-
Notifications
You must be signed in to change notification settings - Fork 136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: make children of match_statement
a case_block
#148
Conversation
That's a great catch! I do think it makes sense to use the same name here. You can always use |
Hmm, actually now I think I reconsider — the arms of a match aren't a list of statements, so this would break the invariant that the contents of a
That's not "consistent" in the sense of every fold being a block — but I think it's also accurate to say that not every fold in Python is a block, right? |
Maybe call the indented part something different, like a |
It's called Also, it looks like it was too permissive to lump the pattern nonterminals in with the expression nonterminals. That causes the following to be accepted by the parser, even though it's invalid Python: x as y |
aaf62d4
to
4b151b5
Compare
(To clarify, this was not meant to suggest that separating expressions and patterns should be part of this PR!) |
match_statement
a block
match_statement
a case_block
d8521fa
to
73986e4
Compare
Can you rebase @theHamsta |
@amaanq upstream has updated to expose For me personally, closing would be fine. |
This change is to follow the naming of the official Python grammar.
The unnecessary conflict can still be removed. |
@dcreager the children of all other indent blocks use the
block
node. It would be more consistent whenmatch_statement
would use the same or should there be a new name for the alternatives?This would be more consistent for the use in queries: https://github.com/nvim-treesitter/nvim-treesitter/pull/2389/files