Expand description
The projection renderer: a stored tree → the Section 5 text.
Read-only and total: there is no parser, and text is never the source of
truth (docs/design.md Section 4). The renderer follows the Section 5
conventions for the seed model’s constructs:
end-delimited keyword blocks, no braces, no significant whitespace- the contract header (
given/produces/requires/on_failure) beforedo purefor an empty effect set- confidence as
Type @ level, with thestructuralbaseline elided - named call arguments, resolved from the enclosing module
Full fidelity to every Section 5 example waits on operators, handlers, and
record/variant definitions existing in the model; those are later slices.
A hole renders as <hole: …> and a missing child as <missing> so an
incomplete or broken tree still renders for review rather than failing.
Structs§
- Addressed
- The Section-5 projection plus the span index that maps any byte position back to the node hash there — the editor substrate.
- Span
- A node’s byte range in the rendered
text. Spans nest: a node’s range strictly contains every child’s; the root is0..text.len().
Functions§
- node_at
- The deepest (most specific) node whose span contains
offset— the node a cursor atoffsetedits.Noneif out of range. - render
- Render the subtree at
rootas Section 5 text. No trailing newline. - render_
addressed - Render
rootand return the projection text together with the hash↔span index.textis byte-identical torender; the spans come from the same renderer run with node bracketing on.