Skip to content

Designate "else"/"else if" branches inside of if statements #143

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

Merged
merged 3 commits into from
Nov 8, 2020
Merged

Designate "else"/"else if" branches inside of if statements #143

merged 3 commits into from
Nov 8, 2020

Conversation

resolritter
Copy link
Contributor

closes #142

code changes are included isolatedly in the first commit

@resolritter resolritter marked this pull request as draft November 3, 2020 22:57
@resolritter resolritter marked this pull request as ready for review November 3, 2020 23:08
Copy link
Contributor

@maxbrunsfeld maxbrunsfeld left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Your explanation in #142 makes sense, and I like this change.

I think the CI failure is because you generated the parser with tree-sitter 0.17.x, but the package.json file still has tree-sitter-cli 0.16.x in the dependencies. I think it would be ok to go ahead and upgrade tree-sitter-cli to the latest version as part of this PR. You just need to change the version number in dependencies to 0.17.3.

grammar.js Outdated
@@ -239,14 +239,13 @@ module.exports = grammar({
optional($._automatic_semicolon)
)),

else_branch: $ => seq('else', $._statement),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you change this name to else_clause? I think that for these parts of statements, we usually use the term "clause" in this and other tree-sitter grammars. See for example catch_clause, finally_clause in this file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed to else_clause

e03246e

@resolritter
Copy link
Contributor Author

I think the CI failure is because you generated the parser with tree-sitter 0.17.x, but the package.json file still has tree-sitter-cli 0.16.x in the dependencies. I think it would be ok to go ahead and upgrade tree-sitter-cli to the latest version as part of this PR. You just need to change the version number in dependencies to 0.17.3.

upgrade done in 353c6fe#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519, we'll see if CI passes...

@resolritter resolritter changed the title Designate else/else if branches inside of if statements Designate "else"/"else if" branches inside of if statements Nov 4, 2020
maxbrunsfeld pushed a commit to tree-sitter/tree-sitter-rust that referenced this pull request Nov 4, 2020
* designate "else_clause" inside of if statements

* upgrade tree-sitter-cli

tree-sitter/tree-sitter-javascript#143 (review)

* regenerate files for else_clause

Co-authored-by: resolritter <[email protected]>
@resolritter
Copy link
Contributor Author

ping @maxbrunsfeld I've made the requested changes. I can open another PR at tree-sitter-typescript for regenerating the parser after this lands.

@maxbrunsfeld maxbrunsfeld merged commit 3d9fe97 into tree-sitter:master Nov 8, 2020
@maxbrunsfeld
Copy link
Contributor

Thanks!

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.

Designate "else"/"else if" branches inside of if statements
2 participants