Renders a scalus.uplc.Term to UPLC text together with the text-range to source-position map that the UPLC source view needs.
The text comes from the ordinary pretty-printer at the same width as Term.show, so the rendered UPLC is exactly what every other Scalus output shows. Offsets are recovered by passing zero-width markers through the printer (org.typelevel.paiges.Doc.zeroWidth, the same mechanism the printer already uses for ANSI styling): markers take part in no layout decision, are emitted verbatim into the rendered string, and are stripped afterwards while recording where each node's text starts and ends.
Public for tooling, but in scalus.uplc.internal and thus with no binary-compatibility guarantees: the .uplc.json format (versioned by SchemaVersion) is the contract, not this API.
True when at least one node of term carries a usable source position, i.e. rendering it would produce a non-empty span table. Terms decoded from CBOR carry no annotations at all, and a source map for them would map nothing.
True when at least one node of term carries a usable source position, i.e. rendering it would produce a non-empty span table. Terms decoded from CBOR carry no annotations at all, and a source map for them would map nothing.
Renders term and maps every positioned node to the text it printed.
Renders term and maps every positioned node to the text it printed.
The rendered text is always identical to term.show; when the program could spoof a marker this is checked, not merely intended (see below). Nodes without an effective source position get no span, and neither do the inner Apply nodes of an application chain: the printer flattens [[[f a] b] c] to [f a b c] and prints only the outermost Apply, whose span covers the whole chain.
A string constant is printed verbatim, so a program can contain text indistinguishable from a marker. Rather than reason about which spoofs are recoverable, whenever a string constant holds a marker character the marked render is verified against an unmarked one, and the whole span table is dropped when they disagree: a source view with no spans is a degraded view, one with wrong text is a wrong one. Programs without such constants — all real ones — need no verification render: every marker in their marked render is genuine.
Schema version of the .uplc.json document. Bump on any incompatible change to its shape so consumers (e.g. the Scalus VS Code extension) can detect and reject documents they don't understand.
Schema version of the .uplc.json document. Bump on any incompatible change to its shape so consumers (e.g. the Scalus VS Code extension) can detect and reject documents they don't understand.
Codec for the .uplc.json document; public so tooling and tests can parse it back. Always emits files/functions/spans, even when empty, so consumers can index them without a presence check. fn is still omitted when absent (jsoniter's transientNone default).
Codec for the .uplc.json document; public so tooling and tests can parse it back. Always emits files/functions/spans, even when empty, so consumers can index them without a presence check. fn is still omitted when absent (jsoniter's transientNone default).