fix(jsx): support {#* block comments *#} inside JSX body#5587
Open
Developer-Linus wants to merge 15 commits intojaseci-labs:mainfrom
Open
fix(jsx): support {#* block comments *#} inside JSX body#5587Developer-Linus wants to merge 15 commits intojaseci-labs:mainfrom
Developer-Linus wants to merge 15 commits intojaseci-labs:mainfrom
Conversation
Add fixture and tests for the {#* ... *#} parser fix, ensuring correct
handling of comment-only braces in JSX children.
Covers three scenarios:
* comment between sibling elements
* comment as the sole child
* comment adjacent to a real {expr}
These cases verify the parser no longer misinterprets or drops
comment-only brace blocks within JSX bodies.
Add four failing tests for the comment injection pass regression where
{#* block comment *#} inside a JSX body is displaced to the end of file
(E5051) instead of being preserved in place.
Root cause:
The comment is classified as inline (anchored to the LBRACE token), but
the parser consumes and drops that LBRACE without attaching it to any
AST node, so the anchor is never found in the doc tree.
Tests cover:
* comment between siblings - must remain between them in output
* comment as the only child - parent element must not be lost
* comment adjacent to a real {expr} - both must survive in order
* no E5051 displaced-comment error is raised
…aseci-labs#5587) Replace shared release-notes entry with unreleased/jaclang/5587.bugfix.md following the new per-PR fragment convention.
kugesan1105
reviewed
Apr 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Parser
Added a guard in
parse_jsx_childso that when a{ }brace pair contains only a comment (which the lexer already consumed), the parser detects the immediately-following}and recurses rather than attempting to parse a missing expression — fixing the parse error.Grammar spec (
jac.spec) updated to reflect the newjsx_childproduction rule.Formatter
Fixed a bug in
CommentInjectionPasswhere{#* ... *#}in a JSX body was displaced to end-of-file.Root cause: the parser consumes the bare
{ }tokens without attaching them to any AST node, so the comment's anchor hash is never found in the doc tree.Fix: detects this pattern (
LBRACEanchor immediately followed byRBRACE) and reclassifies the comment as standalone with anis_jsx_bodyflag, so it is re-emitted wrapped in{ ... }at the correct line position between JSX children.Tests
Added parser and formatter tests covering the
{#* comment *#}case, including a sibling-displacement regression test.Fixture file
jsx_body_comment.jacadded.Docs
Documented the
{#* ... *#}JSX body comment syntax in the quick-guide cheatsheet and the internals design doc.