Commit 41978ec
`scanTopLevel`, `enclosingOpeners`, `sliceBalanced` and `splitTopLevel` each
carried the same seek-to-matching-quote skip, which a NESTED template literal
walks straight out of: the outer template closed at the first inner backtick
and every `code:` position after it in that file went unplaced.
All four now call ONE shared `skipStringLiteral`, a small state machine that
tracks `${ … }` nesting and recurses into literals opened inside an
interpolation. `enclosingOpeners` answers every requested index with a TAGGED
result, so "genuinely inside a string" and "the scanner lost its place" stop
arriving as the same `undefined`; the other three take an optional
`scanReport()`. The tag is certified — `inside-string` is asserted only for a
walk that ends with no unterminated literal, no bracket underflow and an empty
stack.
`--self-test` gains a nested-template fixture per primitive, each PAIRED with a
positive control run through the pre-fix `legacySeekQuote` kept in test scope.
`OBJECT_LITERAL_CODE_HELPER_BLINDNESS` and `INLINE_LITERAL_EXPRESSION_CENSUS`
are re-derived on this tree, with tree drift separated from what the fix moved,
and `SCANNER_LITERAL_BLIND_SPOTS` records the residual class the sweep found
(a regex literal carrying a quote) rather than leaving it to be rediscovered.
Claude-Session: https://claude.ai/code/session_01WLJQhde67SeTccsmnBVarV
Co-authored-by: Claude <noreply@anthropic.com>
1 parent d4ac61f commit 41978ec
1 file changed
Lines changed: 679 additions & 80 deletions
0 commit comments