-
Notifications
You must be signed in to change notification settings - Fork 128
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
Should expression be a subtype of expression_statement instead of a child? #94
Comments
:/ you linked the same thing twice edit: also note that edit 2: i'm guessing what you probably mean then is, should |
Hi @somebody1234, thank you for your reply. I think I may have misunderstood how subtypes and children work. I thought that subtypes generally corresponded to It sounds like adding |
Conceptually, I don't think that an |
Hi @maxbrunsfeld, it sounds like my concept of subtypes and supertypes in the context of Tree-sitter was not correct. Thank you for clarifying. I will close this issue. |
In
grammar.js
,expression
is achoice
ofexpression_statement
: https://github.com/tree-sitter/tree-sitter-python/blob/master/grammar.js#L183-L184In
node-types.json
,expression
is a child ofexpression_statement
: https://github.com/tree-sitter/tree-sitter-python/blob/master/src/node-types.json#L1164-L1182Is this correct? Since
expression
is achoice
ofexpression_statement
, I would have expectedexpression
to be a subtype ofexpression_statement
innode-types.json
, not a child.(I'm interested in this because I want to identify nodes that are valid (syntactically correct) Python by themselves so that I can send them to a REPL. My method for doing this is to check whether they are subtypes of
_compound_statement
or_simple_statement
. But this breaks down forexpression_statement
, which has children instead of subtypes.)Thank you for making tree-sitter-python!
EDIT: Fixed link.
The text was updated successfully, but these errors were encountered: