Documentation
¶
Overview ¶
Package sutl is the dependency-free Go implementation of sUTL 1.0, the sUTL Universal Transform Language (“subtle”).
Index ¶
Constants ¶
const ContractVersion = "1.0.0"
ContractVersion is the sUTL language contract implemented by this module.
const Version = "1.1.0"
Version is this module's release. The language contract is still sUTL 1.0.0.
Variables ¶
This section is empty.
Functions ¶
func AsMap ¶
AsMap reports whether value is a MLSNBN map and returns its entries. Objects decoded with DecodeJSON are maps.
Types ¶
type LimitError ¶ added in v1.1.0
LimitError is returned when evaluation exceeds a limit or the host cancels. Reason is "steps", "depth", or "cancelled". A cancelled error unwraps to the context error.
func (*LimitError) Error ¶ added in v1.1.0
func (e *LimitError) Error() string
func (*LimitError) Unwrap ¶ added in v1.1.0
func (e *LimitError) Unwrap() error
type Program ¶ added in v1.1.0
type Program struct {
// contains filtered or unexported fields
}
Program is a transform compiled to a Go function. Compile once, then Run the same transform against many sources.
func Compile ¶ added in v1.1.0
Compile prepares a transform so it can be applied repeatedly. Dynamic eval (! ) stays on the walker until that transform has been seen, then the compiled form is reused. A library is captured by reference.
func CompileLimited ¶ added in v1.1.0
CompileLimited compiles transform and applies limits on every run.
func (*Program) Run ¶ added in v1.1.0
Run applies the compiled transform to source. A program created with CompileLimited panics with *LimitError if a limit is exceeded. Use RunContext to receive that error as a value.
func (*Program) RunContext ¶ added in v1.1.0
RunContext runs the compiled transform. Limits set by CompileLimited are enforced here, and ctx is checked at every step. A context that cannot be cancelled and a program with no limits use the compiled function directly.
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
Runner evaluates sUTL transforms with an optional transform library.
type Value ¶
type Value = any
Value is a MLSNBN value: a map, list, string, number, boolean, or null.
func DecodeJSON ¶
DecodeJSON reads a MLSNBN value, preserving object key order.