interpreter

package
v1.0.21 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2024 License: GPL-2.0, MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotObject = errors.New("not object")
)
View Source
var Exports = map[string]interface{}{
	"classof":         ClassOf,
	"newRuntimeError": NewRuntimeError,
	"interpreter":     New,
	"insertSemis":     InsertSemis,
}
View Source
var (
	InsertSemis = &Options{ScanMode: tpl.InsertSemis}
)

Functions

func ClassOf

func ClassOf(v interface{}) interface{}

func NewRuntimeError

func NewRuntimeError(msg string) error

Types

type Engine

type Engine struct {
	*tpl.CompileRet
	Interpreter *exec.Object
	// contains filtered or unexported fields
}

func New

func New(ip interface{}, options *Options) (p *Engine, err error)

func (*Engine) Eval

func (p *Engine) Eval(expr string) (err error)

func (*Engine) EvalCode

func (p *Engine) EvalCode(fn *exec.Object, name string, src interface{}) error

func (*Engine) Exec

func (p *Engine) Exec(code []byte, fname string) (err error)

type Options

type Options struct {
	Scanner  tpl.Tokener
	ScanMode tpl.ScanMode
}

Jump to

Keyboard shortcuts

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