A120: Source Token Text
Matched text can often reference the original input range instead of re-encoding decoded characters into a new string.
Mechanism and Invariants
Valid whole-input Go text uses source substrings, with CodePoints-to-byte offsets where needed. Malformed UTF-8 in CodePoints retains replacement-character copying. Ordinary stream ranges use detached copying unless the separate bounded snapshot mechanism applies. A substring keeps its source owner alive; zero-copy does not mean zero retained input. TypeScript's text route respects string/byte input normalization but has JavaScript ownership costs.
Scope and State
Default eligible token text in closure, both VMs, generated Go Node/typed Go and TypeScript. Exact copying depends on input representation and unit.
Reference Control
No universal substring/copy reference control exists.
pego_reference_stream_text controls bounded stream snapshots only.
Evidence and Implementation
Record 010 combines token text and context reuse, reporting lower allocation counts. Its result is historical and not a token-only ablation. It explicitly records whole-input retention as a tradeoff.
Evidence records: 010.
Source owners: input.text and buildOffs,
generated text extraction,
TypeScript text extraction.
The comparison policy distinguishes same-source controls, historical changes and full checkpoints.