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

Enclose grouping parentheses with parens node #222

Merged
merged 1 commit into from
Mar 20, 2023
Merged

Conversation

c42f
Copy link
Member

@c42f c42f commented Mar 20, 2023

Introduce a new kind K"parens" to represent grouping parentheses with a tree node of their own. This makes it simple for tooling to process and preserve parenthesized expressions without resorting to searching through the attached syntax trivia.

An alternative considered here was to use K"block" with a single child which would avoid introducing an extra kind of node. But in that case we couldn't distinguish between a trivial block like (a;) vs bare parentheses (a). It also makes implementing peek_behind more complicated.

Part of #88. Helps with #22 and #134

Introduce a new kind `K"parens"` to represent grouping parentheses with
a tree node of their own. This makes it simple for tooling to process
and preserve parenthesized expressions without resorting to searching
through the attached syntax trivia.

An alternative considered here was to use `K"block"` with a single
child which would avoid introducing an extra kind of node. But in that
case we couldn't distinguish between a trivial block like `(a;)` vs bare
parentheses `(a)`. It also makes implementing `peek_behind` more
complicated.
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.

1 participant