ast

package
v0.2.62 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 19, 2026 License: MPL-2.0 Imports: 0 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package ast defines the runtime value AST nodes shared across the txcl parser, runtime evaluator, and processor. The package is a leaf — it depends on nothing — so downstream packages (runtime, resonator, processor) can all reference it without creating import cycles when the runtime evaluator (chassis/txcl/runtime) is introduced.

Value is a discriminated sum:

  • Literal{V} — a parsed scalar or array literal.
  • PathRef{Path} — an `@x.y.z` envelope reference. Reserved for future use; the parser does not produce this node yet (paths on the RHS of SET/EMIT/WITH are not supported in the current grammar).
  • FunctionCall{Name,Args} — a `&fn(args...)` runtime call. Reserved; parser does not produce this yet either.

See internal docs/todo-txcl-expressions.md for the broader plan; this package lands the AST shape so the runtime evaluator can be added next without a churn-heavy retrofit.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LiteralOrNil

func LiteralOrNil(v Value) interface{}

LiteralOrNil extracts the wrapped value from an ast.Literal, returning nil for any other Value type (including a nil Value). Convenience for transitional code that pre-dates the runtime evaluator — every call site that uses this should ultimately migrate to runtime.Resolve, which handles all three node types.

Types

type FunctionCall

type FunctionCall struct {
	Name string
	Args []Value
}

FunctionCall is a `&fn(args...)` runtime call. Resolved by the runtime evaluator through the function registry. Args may include nested FunctionCall nodes (resolution is recursive).

type Literal

type Literal struct {
	V interface{}
}

Literal wraps a parsed scalar (string, int64, float64, bool) or array literal ([]interface{}). The underlying type is whatever the parser produced — this struct only carries it, it does not constrain it.

type PathRef

type PathRef struct {
	Path string
}

PathRef is an envelope path reference (`@x.y.z`). Resolved by the runtime evaluator against the current envelope.

type Value

type Value interface {
	// contains filtered or unexported methods
}

Value is one node in the value-expression tree. The closed set of implementations is Literal, PathRef, and FunctionCall.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL