package eval
import "cuelang.org/go/internal/core/eval"
Package eval contains the high level CUE evaluation strategy.
CUE allows for a significant amount of freedom in order of evaluation due to the commutativity of the unification operation. This package implements one of the possible strategies.
Index ¶
- func Equal(ctx *adt.OpContext, v, w adt.Value) bool
- func Evaluate(r adt.Runtime, v *adt.Vertex)
- func NewContext(r adt.Runtime, v *adt.Vertex) *adt.OpContext
- type CloseDef
- type Evaluator
- func New(r adt.Runtime) *Evaluator
- func (e *Evaluator) Eval(v *adt.Vertex) errors.Error
- func (e *Evaluator) Evaluate(c *adt.OpContext, v *adt.Vertex) adt.Value
- func (e *Evaluator) NewContext(v *adt.Vertex) *adt.OpContext
- func (e *Evaluator) Stats() *Stats
- func (e *Evaluator) Unify(c *adt.OpContext, v *adt.Vertex, state adt.VertexStatus)
- func (e *Evaluator) UnifyAccept(c *adt.OpContext, v *adt.Vertex, state adt.VertexStatus, accept adt.Acceptor)
- type Stats
Functions ¶
func Equal ¶
func Evaluate ¶
func NewContext ¶
Types ¶
type CloseDef ¶
CloseDef defines how individual FieldSets (corresponding to conjuncts) combine to determine whether a field is contained in a closed set.
Nodes with a non-empty List and IsAnd is false represent embeddings. The ID is the node that contained the embedding in that case.
Nodes with a non-empty List and IsAnd is true represent conjunctions of definitions. In this case, a field must be contained in each definition.
If a node has both conjunctions of definitions and embeddings, only the former are maintained. Conjunctions of definitions define an upper bound of the set of allowed fields in that case and the embeddings will not add any value.
type Evaluator ¶
type Evaluator struct {
// contains filtered or unexported fields
}
func New ¶
func (*Evaluator) Eval ¶
func (*Evaluator) Evaluate ¶
Evaluate is used to evaluate a sub expression while evaluating a Vertex with Unify. It may or may not return the original Vertex. It may also terminate evaluation early if it has enough evidence that a certain value can be the only value in a valid configuration. This means that an error may go undetected at this point, as long as it is caught later.
func (*Evaluator) NewContext ¶
func (*Evaluator) Stats ¶
func (*Evaluator) Unify ¶
Unify implements adt.Unifier.
May not evaluate the entire value, but just enough to be able to compute.
Phase one: record everything concrete Phase two: record incomplete Phase three: record cycle.
func (*Evaluator) UnifyAccept ¶
func (e *Evaluator) UnifyAccept(c *adt.OpContext, v *adt.Vertex, state adt.VertexStatus, accept adt.Acceptor)
UnifyAccept is like Unify, but takes an extra argument to override the accepted set of fields.
Instead of deriving the allowed set of fields, it verifies this set by consulting the given Acceptor. This can be useful when splitting an existing values into individual conjuncts and then unifying some of its components back into a new value. Under normal circumstances, this may not always succeed as the missing context may result in stricter closedness rules.
type Stats ¶
func (*Stats) String ¶
Source Files ¶
closed.go disjunct.go equality.go eval.go optionals.go
- Version
- v0.3.0-alpha1
- Published
- Jul 26, 2020
- Platform
- linux/amd64
- Imports
- 9 packages
- Last checked
- 1 minute ago –
Tools for package owners.