@tikoci/centrs
    Preparing search index...

    Function scanQuotedString

    • Find the end of the double-quoted string that opens at open (H3).

      The one shared string skip for every structural scan in explain. A string is NOT opaque up to the next ": a $[…] or $(…) substitution inside it is CODE, and that code may open strings of its own — :local a "$[[:parse "(\"x\")"]]" is ONE string on the device (CHR 7.23.2 /console/inspect request=highlight classes the following # line comment and both $a occurrences variable-local). A scanner that stops at the first nested " flips its quote phase and reads every later comment as string content; on the frozen 913-script corpus that hid 2,184 device-comment bytes across 7 files, and cost symbols.ts 3.1 points of precision before it grew the frame model this function now shares (#198/#199).

      Frames mirror symbols.ts: a " frame is string phase (\ escapes the next character, $[/$( push a code frame), anything else is code phase (" opens a nested string, brackets nest, a mismatched close is content rather than a close — the same line segment.ts and symbols.ts take elsewhere). Iterative, so deeply nested input cannot overflow the stack. Escapes and comments inside the substitution are NOT interpreted here: the whole string, substitutions included, stays opaque to the caller — only its END moves.

      Frame depth is capped for the same reason MAX_CONTAINER_DEPTH is: explain accepts untrusted editor/MCP input. Past MAX_STRING_FRAME_DEPTH the scan stops and reports the string UNCLOSED — fail-closed, the direction every caller already handles (unterminated-stringstructuralDefectunresolved). Only an input that opens that many frames without closing them can reach it, which is malformed by construction; sequential substitutions ("$[a]$[b]…") pop and never accumulate.

      Parameters

      • text: string
      • open: number

      Returns QuotedStringScan