Versions in this module Expand all Collapse all v0 v0.1.0 Apr 13, 2026 Changes in this version + var ErrBuiltinConflict = errors.New("anyexpr: function name conflicts with built-in") + var ErrCompile = errors.New("anyexpr: compilation failed") + var ErrDuplicateFunction = errors.New("anyexpr: duplicate function registration") + var ErrNotBuiltin = errors.New("anyexpr: name is not a built-in function") + var ErrTypeMismatch = errors.New("anyexpr: expression return type mismatch") + type CheckOpt func(*checkConfig) + type CompileOpt func(*compileConfig) + type Compiler struct + func NewCompiler[T any](opts ...CompilerOpt) (*Compiler[T], error) + func (c *Compiler[T]) Check(sources []*Source, opts ...CheckOpt) error + func (c *Compiler[T]) Compile(src *Source, opts ...CompileOpt) (*Program[T], error) + type CompilerOpt func(*compilerConfig) error + func ReplaceFunction(name string, fn any) CompilerOpt + func WithFunction(name string, fn any) CompilerOpt + type EvalOpt func(*evalConfig) + func WithEvalTrace(w io.Writer) EvalOpt + type MatchOpt func(*matchConfig) + func WithMatchTrace(w io.Writer) MatchOpt + type Program struct + func (p *Program[T]) Eval(env T, opts ...EvalOpt) (any, error) + func (p *Program[T]) Match(env T, opts ...MatchOpt) (bool, error) + func (p *Program[T]) Name() string + func (p *Program[T]) Source() string + type Source struct + func NewSource(name, expr string, opts ...SourceOpt) *Source + func (s *Source) Expr() string + func (s *Source) Name() string + type SourceOpt func(*sourceConfig)