expr

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoBinding = errors.New("reference to unbound variable")

Functions

func CheckValidFieldComponent

func CheckValidFieldComponent(expr Expr) error

func EvalToString

func EvalToString(e Expr, rec record.Record, binds *scope.Bindings) (string, error)

Types

type BaseFieldPath

type BaseFieldPath struct {
	Base Expr
	Path FieldPath
}

func (BaseFieldPath) Eval

func (bfp BaseFieldPath) Eval(rec record.Record, binds *scope.Bindings) (record.Record, error)

func (BaseFieldPath) String

func (bfp BaseFieldPath) String() string

type Const

type Const struct{ Val record.Record }

func (Const) Eval

func (Const) String

func (c Const) String() string

type Expr

type Expr interface {
	fmt.Stringer
	Eval(rec record.Record, binds *scope.Bindings) (record.Record, error)
}

Expr models an expression. Its String method returns a human-readable form.

type FieldPath

type FieldPath []Expr

func (FieldPath) Eval

func (fp FieldPath) Eval(rec record.Record, binds *scope.Bindings) (record.Record, error)

func (FieldPath) String

func (fp FieldPath) String() string

type Func

type Func struct {
	Func     scope.Func
	FuncName string
	Args     []Expr
}

func (Func) Eval

func (f Func) Eval(rec record.Record, binds *scope.Bindings) (record.Record, error)

func (Func) String

func (f Func) String() string

type Template

type Template struct {
	Lits  []string
	Exprs []Expr
}

Template is a string template, alternating string literals and embedded expressions (with literal at begin and end). evals[i] occurs between lits[i] and lits[i+1].

func (Template) Eval

func (t Template) Eval(rec record.Record, binds *scope.Bindings) (record.Record, error)

func (Template) Simplify

func (t Template) Simplify() Expr

func (Template) String

func (t Template) String() string

type Var

type Var struct{ Id scope.Ident }

func (Var) Eval

func (v Var) Eval(rec record.Record, binds *scope.Bindings) (record.Record, error)

func (Var) String

func (v Var) String() string

Directories

Path Synopsis
lex

Jump to

Keyboard shortcuts

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