scalus.uplc.internal

Members list

Type members

Classlikes

Renders a CEK profile to the destinations an scalus.cardano.ledger.EvaluatorReportConfig asks for and indexes the files it wrote in profile-manifest.json.

Renders a CEK profile to the destinations an scalus.cardano.ledger.EvaluatorReportConfig asks for and indexes the files it wrote in profile-manifest.json.

Extracted from scalus.cardano.ledger.PlutusScriptEvaluator so that profiles produced outside the ledger — test suites that evaluate UPLC directly, via ScalusTest.runWithProfileReport — land on disk in exactly the same shape, and tools such as the Scalus VS Code extension consume both identically.

Public for tooling, but in scalus.uplc.internal and thus with no binary-compatibility guarantees: the on-disk format is the contract, not this API.

JVM implementation; the JS build substitutes a no-op stub of the same FQN, keeping ProfileFormatter (HTML/CSS/JS templates, Tarjan pass), the jsoniter manifest codec and the UPLC source-map renderer dead-code-eliminated from the published scalus.js bundle, which transaction builders depend on and which must stay small.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
final case class UplcSourceMap(schemaVersion: Int, uplc: String, files: Seq[String], functions: Seq[String], spans: Seq[UplcSpan])

The .uplc.json document consumed by the Scalus VS Code extension: the UPLC text of a compiled program plus a table mapping ranges of that text back to Scala source positions.

The .uplc.json document consumed by the Scalus VS Code extension: the UPLC text of a compiled program plus a table mapping ranges of that text back to Scala source positions.

files and functions are string tables referenced by UplcSpan.file and UplcSpan.fn.

Value parameters

spans

the mapped regions, sorted by UplcSpan.s ascending, then UplcSpan.e descending, which orders enclosing spans before the spans they contain: binary-searching by offset and resolving a cursor to the innermost containing span work directly on the table. The spans are properly nested, so that resolution is well defined. (Documents written by earlier schema-1 producers carried the spans unsorted, so a defensive consumer may still sort.) The table is empty when nothing could be mapped; uplc is always the full program text.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Renders a scalus.uplc.Term to UPLC text together with the text-range to source-position map that the UPLC source view needs.

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.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
final case class UplcSpan(s: Int, e: Int, n: Int, file: Int, sl: Int, sc: Int, el: Int, ec: Int, fn: Option[Int])

One mapped region of rendered UPLC text.

One mapped region of rendered UPLC text.

Value parameters

e

end character offset into UplcSourceMap.uplc, exclusive

ec

0-based end column of the source position

el

0-based end line of the source position

file

index into UplcSourceMap.files

fn

index into UplcSourceMap.functions, absent when the node carries no enclosing function name

n

the node's post-order index in the term tree (children before parent, fields in declaration order). Post-order is used because it keeps the indices of an already-rendered program stable when that program is later wrapped in Apply nodes to apply parameters.

s

start character offset into UplcSourceMap.uplc, inclusive

sc

0-based start column of the source position

sl

0-based start line of the source position

Attributes

Note

lines are 0-based here, as in scalus.utils.ScalusSourcePos. The profile.json report uses 1-based lines; do not mix the two.

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all