evalx

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2023 License: MIT Imports: 12 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Eval

func Eval(text string, cts ...Context) (any, error)

func SetCacheSize

func SetCacheSize(size int)

Types

type Context

type Context interface {
	ValueOf(ident string) (any, bool)
	MethodOf(ident string) (any, bool)
	CacheOf(text string) (ast.Expr, bool)
	Cache(text string, expr ast.Expr)
}

type Scope

type Scope struct {
	// contains filtered or unexported fields
}

func NewScope

func NewScope(vars ...any) *Scope

func TopScope

func TopScope() *Scope

func (*Scope) Backup

func (it *Scope) Backup(name string)

func (*Scope) Bind

func (it *Scope) Bind(name string, value any)

func (*Scope) Cache

func (it *Scope) Cache(text string, expr ast.Expr)

func (*Scope) CacheOf

func (it *Scope) CacheOf(text string) (ast.Expr, bool)

func (*Scope) Eval

func (it *Scope) Eval(text string) (any, error)

func (*Scope) IsTop

func (it *Scope) IsTop() bool
func (it *Scope) Link(items ...any) *Scope

func (*Scope) Merge

func (it *Scope) Merge(val any) *Scope

func (*Scope) MethodOf

func (it *Scope) MethodOf(ident string) (any, bool)

func (*Scope) Restore

func (it *Scope) Restore(name string)

func (*Scope) UnBind

func (it *Scope) UnBind(name string)
func (it *Scope) UnLink(obj any) *Scope

func (*Scope) ValueOf

func (it *Scope) ValueOf(ident string) (any, bool)

type Stack

type Stack struct {
	Ctx    Context
	Target datax.LinkedList[Target]
	Error  error
	X      any
	Y      any
}

func StackOf

func StackOf(accessor Context) *Stack

func (*Stack) PopTarget

func (it *Stack) PopTarget() Target

func (*Stack) PushTarget

func (it *Stack) PushTarget(target Target)

type Target

type Target = uint
const (
	PROPERTY Target = iota
	METHOD
)

Jump to

Keyboard shortcuts

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