fix: stop regex flags at comment boundaries - #70
Merged
Merged
Conversation
Co-authored-by: WillBooster (Codex CLI) <agent@willbooster.com>
Co-authored-by: WillBooster (Codex CLI) <agent@willbooster.com>
Co-authored-by: WillBooster (Codex CLI) <agent@willbooster.com>
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.
Why
In #51,
/[/]//*c*/instanceof valueis parsed withinstanceofas regex flags. Named comment extras can bypass an immediate flag token's adjacency constraint. Existing open PRs do not cover this category.Requirements
Customer Summary
Comments end regex literals instead of extending their flags. Operators and later statements retain their ordinary structure and source ranges.
Technical Summary
A scanner guard checks the character immediately following the closing slash before the grammar can enter its flagged branch. Existing regex nodes, fields and flag spelling rules remain unchanged. The guard has no persistent state.
Testing
bun run build/ci,bun run verifyand five relevant test files passed (11 tests before tightening comment-node coverage; the three focused files passed again after that change), including native/Wasm corpus, incremental parsing and integrated default-export checks.