A region of one document, carried with that document's comment mask.
Every reader below the statement walk asks its questions of a statement's
text or of a do={…} body — and a statement's text CONTAINS its whole
nested subtree, so each enclosing level re-derived the mask, and the
statement index behind it, over bytes an inner level had already read. That
is the O(bytes x depth) term: a 60 KiB document nested 64 deep masked 27.7 MB
(#322).
A range replaces the substring. text and masked are always the WHOLE
document; start and end say which part of it this reader may look at. The
mask is then derived once per document and every nested reading is an offset
into it.
Soundness is a property of where the ranges come from, not of this type: a
comment mask is decided by the statement context a byte sits in, and a
statement boundary and a scope body both begin one — statement-leading, no
continuation pending, an enclosing context that admits statements. So the
mask of such a region is the document's mask restricted to it. Readers still
have to be told the floor (see scope-brace.ts → scopeNameFromMasked) so
that lookback stops where a fresh call on the region alone would stop.
A region of one document, carried with that document's comment mask.
Every reader below the statement walk asks its questions of a statement's
textor of ado={…}body — and a statement's text CONTAINS its whole nested subtree, so each enclosing level re-derived the mask, and the statement index behind it, over bytes an inner level had already read. That is the O(bytes x depth) term: a 60 KiB document nested 64 deep masked 27.7 MB (#322).A range replaces the substring.
textandmaskedare always the WHOLE document;startandendsay which part of it this reader may look at. The mask is then derived once per document and every nested reading is an offset into it.Soundness is a property of where the ranges come from, not of this type: a comment mask is decided by the statement context a byte sits in, and a statement boundary and a scope body both begin one — statement-leading, no continuation pending, an enclosing context that admits statements. So the mask of such a region is the document's mask restricted to it. Readers still have to be told the floor (see
scope-brace.ts→scopeNameFromMasked) so that lookback stops where a fresh call on the region alone would stop.