Coder Social home page Coder Social logo

Comments (4)

somebody1234 avatar somebody1234 commented on May 20, 2024 1

:/ 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.

andycraig avatar andycraig commented on May 20, 2024

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.

maxbrunsfeld avatar maxbrunsfeld commented on May 20, 2024

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.

andycraig avatar andycraig commented on May 20, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.