Conversation
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Author
|
ohh shoot. Sorry, the clanker decided to make these PRs. If you don't care for em, close it. This one is feature creep nobody but me needed. Sorry again. |
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.
What
ParsedScript.comments: every comment the lexer skipped in that script, in source order, as{ pos, end }spans from the#up to (not including) the newline. Absent when there are none, likeerrors. A shebang staysshebangand is not listed. Comments inside a lazily parsed substitution are on that nested script, again likeerrors.Why
An indexer (nyaa-lexicon's Bash provider) wants comment spans from the same lexer that decided where a comment opens. Without this it needs a second scanner beside the parser to find them, which re-derives the quote and heredoc rules the lexer already has.
How
readNext; the value scanners never see a comment.parseArrayElementsmerges its sub-lexer's spans, since an array body is lexed when the assignment is parsed; the parser sorts once at the end so the list stays in source order.Tests
test/comments.test.ts: ordering, absence, end-of-input and CRLF ends, shebang,#inside words, quotes,${x#pre}and heredoc bodies, compound commands and array bodies, nested substitution scripts, and error recovery. Format, lint, tsc and the full suite pass (1712).Happy to rename the field or the type if you prefer another shape.