Skip to content

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