Comments (4)
:/ you linked the same thing twice
edit: also note that node-types.json
is generated (from grammar.js
)
edit 2: i'm guessing what you probably mean then is, should expression_statement
be a supertype, which can certainly be done (one of the choices isn't a node type so that will need to be refactored but otherwise it looks fine) so we'll just have to wait for max's reply i guess.
from tree-sitter-python.
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 choice
, but reading the docs again I see that they correspond to supertypes.
It sounds like adding expression_statement
as a supertype would resolve this particular case but I'd probably need the same thing to be done for lots of different node types (across multiple languages too, as I'm aiming for this to be language-independent). So I think what I actually need to do is modify my algorithm to identify child nodes corresponding to choice
.
from tree-sitter-python.
Conceptually, I don't think that an expression
is a subtype of an expression_statement
. In my mind, statements and expressions are two distinct categories of nodes. An expression_statement
is a simple type of statement, which contains an expression (or an assignment, which can't occur as a normal expression).
from tree-sitter-python.
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.
from tree-sitter-python.
Related Issues (20)
- Tree-Sitter Python 0.20.1 - parsing variable assignment with var tuple gives incorrect output HOT 2
- assert comparison with await func is parsed incorrectly
- Parsing f-strings with unpackings
- Assertion failed: isa<X>(Val) && "cast<Ty>() argument of incompatible type!" HOT 3
- Migrate scanner to C HOT 1
- Deadlock/memory leak/crash when parsing a specific file HOT 8
- Not working on Windows with latest nvim-treesitter version HOT 1
- Expose real string quotes in a tree to don't mislead HOT 3
- Unable to parse match statements HOT 1
- Dedent regression in valid ternary expression in f-string
- Parsing python code failed with, ValueError: Parsing Failed. HOT 2
- `Error during compilation: cannot execute ‘cc1plus’: execvp: No such file or directory` HOT 2
- Missing git tag for v0.20.2 HOT 2
- Two nodes with kind "lambda" in 0.20.2 HOT 1
- Parsing error in while loop HOT 3
- Cannot compile due to call to undeclared function 'static_assert' HOT 7
- Comment parsing HOT 2
- 3.12 "`type`" soft keyword (PEP 0695) HOT 1
- Extra indent when using an open bracket/parenthesis in string literal HOT 1
- Helping injected languages parse docstrings HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tree-sitter-python.