eval

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2025 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrSymbolExists = errors.New("symbol exists")

Functions

func EnvToMapAny added in v0.0.7

func EnvToMapAny(env map[string]*ir.Node) map[string]any

func ExpandAny

func ExpandAny(v any, env Env) (any, error)

func ExpandEnv

func ExpandEnv(node *ir.Node, env Env) error

func ExpandIR

func ExpandIR(node *ir.Node, env map[string]any) (*ir.Node, error)

func ExpandLineComment

func ExpandLineComment(node *ir.Node, env Env) error

func ExpandString

func ExpandString(v string, env map[string]any) (string, error)

func FromAny added in v0.0.7

func FromAny(v any) (*ir.Node, error)

func GetRaw

func GetRaw(v string) string

GetRaw extracts the name from a .[name] reference syntax. It returns the name without the ".[" prefix and "]" suffix. If the string is not in .[name] format, it returns an empty string. Example: GetRaw(".[number]") returns "number"

func MapAnyToIR added in v0.0.7

func MapAnyToIR(ma map[string]any) (*ir.Node, error)

func MarshalJSON

func MarshalJSON(node *ir.Node) ([]byte, error)

func Register

func Register(s Symbol) error

func SplitChild

func SplitChild(opDoc *ir.Node) (tag string, args []string, child *ir.Node, err error)

func ToAny added in v0.0.7

func ToAny(node *ir.Node) any

Types

type Env

type Env map[string]any

type EvalFunc

type EvalFunc func(node *ir.Node, env Env) (*ir.Node, error)

type Op

type Op interface {
	Eval(doc *ir.Node, env Env, f EvalFunc) (*ir.Node, error)
	String() string
}

type Symbol

type Symbol interface {
	String() string
	Instance(child *ir.Node, args []string) (Op, error)
}

func B64Enc

func B64Enc() Symbol

func Eval

func Eval() Symbol

func Exec

func Exec() Symbol

func File

func File() Symbol

func Lookup

func Lookup(s string) Symbol

func OSEnv

func OSEnv() Symbol

func Script

func Script() Symbol

func Symbols

func Symbols() []Symbol

func ToInt

func ToInt() Symbol

func ToString

func ToString() Symbol

func ToValue

func ToValue() Symbol

Jump to

Keyboard shortcuts

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