Repository navigation
feat: ship the literal scanning header for derived grammars - #163
Merged
Merged
Conversation
Co-authored-by: WillBooster (Claude Code) <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
@willbooster/tree-sitter-typescriptbuilds its grammar from this package'sgrammar.js, but its external scanner keeps its own copies of the template-character and JSX-text scanning. JavaScript 21's grammar adds an_template_escape_sequenceexternal token that validates untagged template escapes insrc/literal.h; shipping that header lets the TypeScript scanner include it instead of copying it again, so later fixes to literal scanning reach TypeScript through a dependency update.Requirements
src/literal.h, the self-contained part of the scanner that TypeScript can include unchanged; the rest ofsrc/scanner.cis interleaved with TypeScript-specific logic in TypeScript's own scanner.Customer Summary
The npm package now also contains
src/literal.h. Parsing is unchanged.Technical Summary
package.json: addssrc/literal.htofiles.README.md: notes that extending grammars' scanners can include it.Testing
bun run verify;npm pack --dry-runlistssrc/literal.h. The TypeScript package's existing check that its vendored JavaScript files match the installed package will cover the header once it is vendored there.