Documentation
¶
Overview ¶
Package expression defines the single shared expression and rule evaluation contract (PLUGIN-007). Every feature — computed fields, constraints, workflow preconditions, and rules — must evaluate through one deterministic, side-effect-free Evaluator over a typed AST and a typed Value model.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ErrExprDepthExceeded ¶
type ErrExprDepthExceeded struct {
Limit int
}
ErrExprDepthExceeded reports an AST deeper than the allowed limit.
func (ErrExprDepthExceeded) Error ¶
func (e ErrExprDepthExceeded) Error() string
type ErrExprParse ¶
ErrExprParse is returned for parse failures.
func (ErrExprParse) Error ¶
func (e ErrExprParse) Error() string
type ErrExprTypeMismatch ¶
type ErrExprTypeMismatch struct {
Got, Want string
}
ErrExprTypeMismatch reports an operation on incompatible value kinds.
func (ErrExprTypeMismatch) Error ¶
func (e ErrExprTypeMismatch) Error() string
type ErrUnknownFunction ¶
type ErrUnknownFunction struct {
Name string
}
ErrUnknownFunction reports a call to a function outside the closed registry.
func (ErrUnknownFunction) Error ¶
func (e ErrUnknownFunction) Error() string
type Evaluator ¶
Evaluator evaluates an AST against a scope, deterministically and with no side effects.
type Expr ¶
type Expr struct {
Kind ExprKind
// Literal
Value Value
// Ident
Name string
// Binary
Op string // + - * / = != < <= > >= AND OR
L, R *Expr
// Call / Aggregate
Func string // ROUND | SUM
Args []*Expr
}
Expr is a typed AST node.
type ParseResult ¶
ParseResult is the outcome of parsing an expression source.
type Scope ¶
type Scope interface {
Lookup(path string) (Value, bool)
Aggregate(fn, table, field string) (Value, error)
}
Scope resolves identifiers and aggregates. Lookup returns typed values only.
type TreeEvaluator ¶
type TreeEvaluator struct {
MaxDepth int
}
TreeEvaluator is a deterministic, depth-limited Evaluator. It performs no clock, randomness, or I/O; evaluation order is fixed by the AST.
func NewTreeEvaluator ¶
func NewTreeEvaluator() *TreeEvaluator
NewTreeEvaluator returns an evaluator with a default depth limit of 64.