Skip to content

Fix comment serialization: multi-token NL_OR_COMMENT and classification #281

Open
kkozik-amplify wants to merge 1 commit intorelease/8.xfrom
comments
Open

Fix comment serialization: multi-token NL_OR_COMMENT and classification #281
kkozik-amplify wants to merge 1 commit intorelease/8.xfrom
comments

Conversation

@kkozik-amplify
Copy link
Copy Markdown
Collaborator

NewLineOrCommentRule.serialize() now concatenates all child tokens instead of only reading the first, fixing silently dropped comments in multi-token new_line_or_comment nodes. BinaryOpRule distinguishes its trailing new_line_or_comment (which can absorb body-level comments from the grammar) from expression-internal comments, routing absorbed standalone comments to comments and keeping expression-internal ones in inline_comments.

this is a fix on top of comment serialization feature introduced with version 8 (#134)

…on (#134)

NewLineOrCommentRule.serialize() now concatenates all child tokens instead of
only reading the first, fixing silently dropped comments in multi-token
new_line_or_comment nodes. BinaryOpRule distinguishes its trailing
new_line_or_comment (which can absorb body-level comments from the grammar)
from expression-internal comments, routing absorbed standalone comments to
__comments__ and keeping expression-internal ones in __inline_comments__.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@kkozik-amplify kkozik-amplify requested a review from a team as a code owner April 3, 2026 17:43
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