Skip to content

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

Merged
kkozik-amplify merged 1 commit intorelease/8.xfrom
comments
Apr 7, 2026
Merged

Fix comment serialization: multi-token NL_OR_COMMENT and classification #281
kkozik-amplify merged 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
@kkozik-amplify kkozik-amplify merged commit e9be26b into release/8.x Apr 7, 2026
7 of 8 checks passed
@kkozik-amplify kkozik-amplify deleted the comments branch April 7, 2026 09:15
kkozik-amplify added a commit that referenced this pull request Apr 7, 2026
…on (#134) (#281)

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>
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.

3 participants