feat(generators): token-level string interpolation metadata + string fixes#9
Open
theoephraim wants to merge 6 commits into
Open
feat(generators): token-level string interpolation metadata + string fixes#9theoephraim wants to merge 6 commits into
theoephraim wants to merge 6 commits into
Conversation
Owner
|
Hi @theoephraim, |
Author
|
yes - apologies when I saw what was first created, I had it cranking away to make it more clear :) |
Owner
|
The main branch has undergone some major restructurings. I don’t have the permission to push changes to this PR. Could you handle the merge conflicts or grant me the push permission? |
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.
Apologies in advance for the AI authored PR. This was encountered while wiring up a parser for varlock - the language is called "@env-spec" and is a small DSL on top of familiar dotenv syntax which includes decorator style comments and function calls.
From what I understand, it was having some issues with handling backtick quotes correctly in the generated textmate grammar, as well as string template style regions.
Why this exists (even if reimplemented differently)
This PR is intended to document and lock down specific behavior needed by env-spec-style DSL grammars. If the implementation here is not desired, that is totally fine; the important part is preserving these scenarios.
Reimplementation contract (must-pass behavior)
TextMate backtick delimiter inference must be correct for escaped backtick strings.
beginis`endis`|$"delimitersInterpolation metadata must be first-class on string tokens and propagate across generators.
YAML quoted-scalar continuation checks must only run for grammars that opt into block scalars.
indent.blockScalar, inline multiline quoted values such asKEY="line1\nline2"must parse (no YAML continuation indentation error).Tests that encode these use cases
test/env-spec-regressions.tstest/interpolation-metadata.tsIf this PR is replaced with a cleaner implementation, keeping these tests (or equivalent) should preserve the same user-facing behavior.
Summary of changes in this PR
indent.blockScalarinterpolation)interpolationmetadata in TextMate, Monarch, and tree-sitter generationNew token option
interpolationcan be declared on string tokens:Notes
Validation
npm test15/15 basic tests pass17/17 interpolation-metadata checks pass4/4 env-spec regression checks pass