Skip to content
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

feat(grammar): semicolon can be omitted for the last statement in block #434

Merged
merged 2 commits into from
Jun 18, 2024

Conversation

anton-trunov
Copy link
Member

@anton-trunov anton-trunov commented Jun 18, 2024

Closes #427

  • I have updated CHANGELOG.md
  • I have added tests to demonstrate the contribution is correctly implemented: this usually includes both positive and negative tests, showing the happy path(s) and featuring intentionally broken cases
  • I have run all the tests locally and no test failure was reported
  • I have run the linter, formatter and spellchecker
  • I did not do unrelated and/or undiscussed refactorings

@anton-trunov anton-trunov added this to the v1.4.0 milestone Jun 18, 2024
@anton-trunov anton-trunov self-assigned this Jun 18, 2024
Copy link
Member

@novusnota novusnota left a comment

Choose a reason for hiding this comment

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

Cool idea with lookaheads!

Unfortunately (?), lookahead assertions are not feasible in LR(1) grammar, which would cause a bit of pondering around to implement this in the tree-sitter :)

I'll probably go with grouping all statements requiring a terminating semicolon and approaching them similar to how it's done in #395. UPD: or just choice(";", "}"), hmm

@anton-trunov anton-trunov merged commit 4260097 into main Jun 18, 2024
3 checks passed
@anton-trunov anton-trunov deleted the optional-semicolon-after-last-stmt branch June 18, 2024 12:53
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.

Make semicolon (;) optional for the last statement in a block
2 participants