qlang

package
v0.2.90 Latest Latest
Warning

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

Go to latest
Published: May 28, 2016 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// InsertSemis is interpreter options that means to insert semis smartly.
	InsertSemis = (*Options)(interpreter.InsertSemis)
)

Functions

func Debug

func Debug(fn func())

Debug sets dump code mode to "1" for debug.

func Import

func Import(mod string, table map[string]interface{})

Import imports a module written in Go.

func SetAutoCall

func SetAutoCall(t reflect.Type)

SetAutoCall is reserved for internal use.

func SetDumpCode

func SetDumpCode(dumpCode string)

SetDumpCode sets dump code mode:

"1" - dump code with rem instruction.
"2" - dump code without rem instruction.
else - don't dump code.

func SetFindEntry

func SetFindEntry(fn func(file string, libs []string) (string, error))

SetFindEntry sets the `FindEntry` function.

func SetOnPop

func SetOnPop(fn func(v interface{}))

SetOnPop sets OnPop callback.

func SetReadFile

func SetReadFile(fn func(file string) ([]byte, error))

SetReadFile sets the `ReadFile` function.

Types

type Options

type Options interpreter.Options

Options represent interpreter options.

type Qlang

type Qlang struct {
	*exec.Context
	// contains filtered or unexported fields
}

A Qlang represents the qlang compiler and executor.

func New

func New(options *Options) (lang *Qlang, err error)

New returns a new qlang instance.

func (*Qlang) Cl

func (p *Qlang) Cl(codeText []byte, fname string) (end int, err error)

Cl compiles a source code.

func (*Qlang) Eval

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

Eval compiles and executes a source code.

func (*Qlang) Exec

func (p *Qlang) Exec(codeText []byte, fname string) (err error)

Exec compiles and executes a source code.

func (*Qlang) InjectMethods added in v0.2.4

func (p *Qlang) InjectMethods(pcls interface{}, code []byte) (err error)

InjectMethods injects some methods into a class. `pcls` can be a `*exec.Class` object or a `string` typed class name.

func (*Qlang) SafeCl

func (p *Qlang) SafeCl(codeText []byte, fname string) (end int, err error)

SafeCl compiles a source code, without panic (will convert panic into an error).

func (*Qlang) SafeEval

func (p *Qlang) SafeEval(expr string) (err error)

SafeEval compiles and executes a source code, without panic (will convert panic into an error).

func (*Qlang) SafeExec

func (p *Qlang) SafeExec(code []byte, fname string) (err error)

SafeExec compiles and executes a source code, without panic (will convert panic into an error).

func (*Qlang) SetLibs

func (p *Qlang) SetLibs(libs string)

SetLibs sets lib paths for searching modules.

Jump to

Keyboard shortcuts

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