Skip to content

Add node fields - #39

Merged
maxbrunsfeld merged 5 commits into
masterfrom
node-fields
Jul 18, 2019
Merged

maxbrunsfeld merged 5 commits into
masterfrom
node-fields

Conversation

@maxbrunsfeld

@maxbrunsfeld maxbrunsfeld commented Feb 13, 2019 •

Copy link
Copy Markdown
Contributor

Depends on tree-sitter/tree-sitter#271

I'm just opening this up for some feedback on another example of node fields. It's currently in an unfinished state. I'm curious what you think of the test changes. Some highlights:

  • I added a new visible block node to represent blocks of statements. I think this makes rules like if_statement look more similar to other languages.
  • If statements now have exactly one condition, exactly one consequence, and zero or more alternatives (which can either be else_clauses or elif_clauses.
  • I added several other fields to several other types of nodes, and updated a bunch of the tests to assert about the fields.

/cc @rewinfrey @robrix @aymannadeem

@aymannadeem

Copy link
Copy Markdown
Contributor

Thanks @maxbrunsfeld! ⚡️

I added a new visible block node to represent blocks of statements. I think this makes rules like if_statement look more similar to other languages.

I haven't done any special treatment for blocks of statements; should I introduce something to handle block as a new record field, or is the shape of data types fine as is? I don't have my head deep enough in this space to tell by skimming, so I'd need to actually test it out...

If statements now have exactly one condition, exactly one consequence, and zero or more alternatives (which can either be else_clauses or elif_clauses).

This closely lines up with the tests I've been using to date; the only thing I'd update in my test JSON file is the alternative to make multiple true instead of false.

@maxbrunsfeld
maxbrunsfeld merged commit 0bd91de into master Jul 18, 2019
@maxbrunsfeld
maxbrunsfeld deleted the node-fields branch July 18, 2019 19:08
@smacker smacker mentioned this pull request Nov 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants