Blink: tokenize complex interpolation; ratchet mautic 0.07% and laravel 7.25% - #146
Merged
Merged
Conversation
Split a double-quoted string that contains a complex "{$...}" interpolation
into literal chunks (keeping the quote, "{" and "}") with the inner
expression lexed as real tokens, so array fixers can reflow an array embedded
in a string ("...{$x->trans('...', [ ... ])}..."). Render stays byte-exact.
ExplicitStringVariable now also wraps simple variables in the continuation
chunks of such a split string.
TomasVotruba
force-pushed
the
tv-blink-lexer-interp
branch
from
October 5, 2026 21:08
b169a50 to
1d3fbeb
Compare
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.
Teaches blink's lexer to tokenize complex
{$...}interpolation, clearing the last reflow-able mautic diff, and ratchets both parity gates.Lexer: complex interpolation
blink folded every double-quoted string into one atomic token, so it could not reflow an array embedded in an interpolated string.
lexInterpolatedStringnow splits a double-quoted string that contains a complex{$...}interpolation into: a literal chunk ending at{, the inner expression lexed as real tokens, a chunk starting at}, repeated, then the closing chunk. The quote, braces, and all literal text stay in the emitted string chunks, soRenderstays byte-exact. Simple$var,${...}, single-quoted strings and heredocs are untouched. Nested, multiple, and escaped interpolations are handled via brace-depth tracking. One consumer (ExplicitStringVariable) was updated to treat a}-leading continuation chunk as interpolation body.Array fixers can now see the
[...]inside"...{$this->translator->trans('...', [ ... ])}..."and reflow it - fixing SummarizeCommand.Round-trip proven byte-identical across 4737 mautic files, 17 rector-src files, and 9 hand-written edge cases (nested dynamic access, multiple interps, embedded arrays, escapes, embedded quotes,
${simple}).Gates
.html.phpinline-HTMLArrayIndentationartifacts; FieldsTypeTrait'sTokenSkipper::skipBlocksReversednot skipping closure/destructuring blocks).Full blink suite, go vet, golangci-lint green; strict rector-src 1:1 gate stays 0-diff; zero mautic regressions.