// simple-var-store.go package expr type SimpleVarStore struct { varStore map[string]any } func NewSimpleVarStore() *SimpleVarStore { return &SimpleVarStore{ varStore: make(map[string]any), } } func (ctx *SimpleVarStore) Clone() (clone exprContext) { clone = &SimpleVarStore{ varStore: CloneMap(ctx.varStore), } return clone } func (ctx *SimpleVarStore) GetVar(varName string) (v any, exists bool) { v, exists = ctx.varStore[varName] return } func (ctx *SimpleVarStore) SetVar(varName string, value any) { ctx.varStore[varName] = value } func (ctx *SimpleVarStore) EnumVars(acceptor func(name string) (accept bool)) (varNames []string) { varNames = make([]string, 0) for name := range ctx.varStore { if acceptor != nil { if acceptor(name) { varNames = append(varNames, name) } } else { varNames = append(varNames, name) } } return } func (ctx *SimpleVarStore) GetFuncInfo(name string) (f exprFunc) { return } func (ctx *SimpleVarStore) Call(name string, args []any) (result any, err error) { return } func (ctx *SimpleVarStore) RegisterFunc(name string, functor Functor, minArgs, maxArgs int) { }