Repository navigation
Don't scope backslash sequences as escapes in String.raw templates - #1081
Open
Akihiro Nagai (314systems) wants to merge 1 commit into
Open
Akihiro Nagai (314systems) wants to merge 1 commit into
Akihiro Nagai (314systems) wants to merge 1 commit into
Conversation
Add a dedicated `template-raw` rule for String.raw tagged templates.
Backslashes are still consumed together with the following character,
so `\`` does not close the template and `\${` does not start a
substitution, but no constant.character.escape scope is applied.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Author
|
@microsoft-github-policy-service agree |
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.
Fixes #1039
Adds a dedicated
template-rawrule forString.rawtagged templates, so backslash sequences inside them are no longer scoped asconstant.character.escape.A backslash is still consumed together with the following character, so
\`doesn't close the template and\${doesn't start a substitution (matching runtime behavior).Other tagged templates and plain templates are unchanged. Aliases such as
const r = String.raw; r...`` can't be detected by the grammar and still get escape scopes.Tests: added
tests/cases/Issue1039.ts, all baselines pass.🤖 Generated with Claude Code