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.
@c42f c42f merged commit 70c908f into main Mar 20, 2023
@c42f c42f deleted the c42f/parens-node-3 branch March 20, 2023 20:49
c42f added a commit to JuliaLang/julia that referenced this pull request Oct 17, 2025
…x.jl#222)

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