Documentation ¶
Index ¶
- Constants
- Variables
- func CoerceToBool(v Value) bool
- func IsIterable(v Value) bool
- func IsReadable(v Value) bool
- func MakeNonRecoverableError(err error) error
- func ToString(v Value) string
- func TypeName(v Value) string
- type Array
- func (a *Array) Add(v Value)
- func (a *Array) Find(v Value) int
- func (a *Array) Get(index int) Value
- func (a *Array) Index(key Value) (Value, error)
- func (a *Array) IndexRef(key Value) (ValueRef, error)
- func (a *Array) Len() int
- func (a *Array) MakeIterator() Iterator
- func (a *Array) Put(index int, v Value)
- func (a *Array) Slice(b, e Value) (Value, error)
- func (a *Array) String() string
- func (a *Array) Traits() Traits
- func (a *Array) Type() string
- type Bool
- type Callable
- type CloseFn
- type Closer
- type Closure
- type CompiledPackage
- type Emitter
- func (e *Emitter) AddGlobalParam(name string, global int) bool
- func (e *Emitter) AddLiteral(v Value) int
- func (e *Emitter) Emit(pos token.Pos, op OpCode, operand1 uint32, operand2 uint16)
- func (e *Emitter) EmitJump(pos token.Pos, op OpCode, label *Label, operand2 uint16)
- func (e *Emitter) NewFn(name string) int
- func (e *Emitter) NewLabel() *Label
- func (e *Emitter) PopFn()
- func (e *Emitter) PushFn(fn int)
- func (e *Emitter) ResolveLabel(label *Label)
- func (e *Emitter) SetFuncMinArgs(n int)
- func (e *Emitter) SetGlobalCount(n int)
- func (e *Emitter) ToCompiledPackage() *CompiledPackage
- type ExportRegistry
- type FallbackEvaluator
- type Float
- type Fn
- type FrameCrumb
- type FrameInfo
- type ILIterator
- type Indexable
- type Instr
- type Int
- type Iterable
- type Iterator
- type Label
- type Location
- type NativeFn
- type NativeIterator
- type NonRecoverableError
- type Object
- func (o *Object) Clone() *Object
- func (o *Object) Delete(key Value)
- func (o *Object) ForEach(f func(k, v Value) bool)
- func (o *Object) Get(k Value) (Value, bool)
- func (o *Object) GetFirst() (key Value, val Value)
- func (o *Object) GetNext(key Value) (nextKey Value, nextVal Value)
- func (o *Object) Has(k Value) bool
- func (o *Object) Index(k Value) (Value, error)
- func (o *Object) IndexRef(k Value) (ValueRef, error)
- func (o *Object) Len() int
- func (o *Object) MakeIterator() Iterator
- func (o *Object) Put(k, v Value)
- func (o *Object) String() string
- func (o *Object) Traits() Traits
- func (o *Object) Type() string
- type Op
- type OpCode
- type Operable
- type PackageSymbol
- type PackageSymbolType
- type Param
- type Readable
- type Reader
- type Regex
- type RuntimeError
- func (e *RuntimeError) Error() string
- func (e *RuntimeError) Index(k Value) (Value, error)
- func (e *RuntimeError) IndexRef(k Value) (ValueRef, error)
- func (e *RuntimeError) Message() string
- func (e *RuntimeError) String() string
- func (e *RuntimeError) Traits() Traits
- func (e *RuntimeError) Type() string
- func (e *RuntimeError) Unwrap() error
- type String
- func (s String) EvalOp(op Op, operand Value) (Value, error)
- func (s String) Index(key Value) (Value, error)
- func (s String) IndexRef(key Value) (ValueRef, error)
- func (s String) Len() int
- func (s String) MakeIterator() Iterator
- func (s String) MakeReader() Reader
- func (s String) Slice(b, e Value) (Value, error)
- func (s String) String() string
- func (s String) Traits() Traits
- func (s String) Type() string
- type Traits
- type VM
- func (m *VM) Block(f func(ctx context.Context))
- func (m *VM) Call(callable Value, args []Value, nret int) ([]Value, error)
- func (m *VM) Context() context.Context
- func (m *VM) GetCallerArgs() []Value
- func (m *VM) GetCallerNArg() int
- func (m *VM) GetFrameCrumb(n int) FrameCrumb
- func (m *VM) GetFrameInfo(crumb FrameCrumb) FrameInfo
- func (m *VM) GetStackInfo() []FrameInfo
- func (m *VM) GetUserData(key interface{}) interface{}
- func (m *VM) IsCallerPipeline() bool
- func (m *VM) IsPipeline() bool
- func (m *VM) IterClose(iter Iterator) error
- func (m *VM) IterNext(iter Iterator, nret int) ([]Value, error)
- func (m *VM) PopContext() context.Context
- func (m *VM) PushContext(ctx context.Context)
- func (m *VM) RegisterCloser(c Closer)
- func (m *VM) Run(args []Value) error
- func (m *VM) SetParam(n string, v Value) error
- func (m *VM) SetUserData(key, value interface{})
- func (m *VM) ShuttingDown() bool
- func (m *VM) SignalError(err error)
- func (m *VM) StartCoroutine(callable Value) error
- func (m *VM) UnregisterCloser(c Closer)
- type Value
- type ValueRef
Constants ¶
View Source
const ( CallArgCountMask uint32 = 0x3FFFFFFF CallExpandFlag uint32 = 0x80000000 CallPipelineFlag uint32 = 0x40000000 )
Variables ¶
View Source
var ( True = Bool{true} False = Bool{false} )
View Source
var ErrCannotCallNil = errors.New("cannot evaluate function call because target is nil")
View Source
var ErrDivByZero = errors.New("divide by zero")
View Source
var ErrDivideByZero = errors.New("divide by zero")
View Source
var ErrIsNotIterable = errors.New("is not iterable")
View Source
var ErrIsNotReadable = errors.New("is not readable")
View Source
var ErrOperationNotSupported = errors.New("operation not supported")
Functions ¶
func CoerceToBool ¶
func IsIterable ¶
func IsReadable ¶
func MakeNonRecoverableError ¶ added in v0.3.0
Types ¶
type Array ¶
type Array struct {
// contains filtered or unexported fields
}
func NewArrayWithSlice ¶
func (*Array) MakeIterator ¶
type CompiledPackage ¶ added in v0.3.0
type CompiledPackage struct { Metadata *meta.Metadata MainFnNdx int Symbols map[string]PackageSymbol // contains filtered or unexported fields }
type Emitter ¶
type Emitter struct {
// contains filtered or unexported fields
}
func NewEmitter ¶
func NewEmitter() *Emitter
func (*Emitter) AddLiteral ¶
func (*Emitter) ResolveLabel ¶
func (*Emitter) SetFuncMinArgs ¶
func (*Emitter) SetGlobalCount ¶
func (*Emitter) ToCompiledPackage ¶ added in v0.3.0
func (e *Emitter) ToCompiledPackage() *CompiledPackage
type ExportRegistry ¶ added in v0.3.0
type FallbackEvaluator ¶ added in v0.3.0
type FrameCrumb ¶
type FrameCrumb struct {
// contains filtered or unexported fields
}
func (*FrameCrumb) IsZero ¶
func (c *FrameCrumb) IsZero() bool
type ILIterator ¶
type ILIterator struct {
// contains filtered or unexported fields
}
func (*ILIterator) IterNRet ¶
func (i *ILIterator) IterNRet() int
func (*ILIterator) String ¶
func (e *ILIterator) String() string
func (*ILIterator) Traits ¶ added in v0.3.0
func (e *ILIterator) Traits() Traits
func (*ILIterator) Type ¶
func (e *ILIterator) Type() string
type NativeFn ¶
type NativeFn struct {
// contains filtered or unexported fields
}
func NewNativeFn ¶ added in v0.2.0
type NativeIterator ¶
type NativeIterator struct {
// contains filtered or unexported fields
}
func (*NativeIterator) Close ¶
func (i *NativeIterator) Close(m *VM) error
func (*NativeIterator) Closed ¶
func (i *NativeIterator) Closed() bool
func (*NativeIterator) IterNRet ¶
func (i *NativeIterator) IterNRet() int
func (*NativeIterator) String ¶
func (i *NativeIterator) String() string
func (*NativeIterator) Traits ¶ added in v0.3.0
func (i *NativeIterator) Traits() Traits
func (*NativeIterator) Type ¶
func (i *NativeIterator) Type() string
type NonRecoverableError ¶ added in v0.3.0
type NonRecoverableError struct {
// contains filtered or unexported fields
}
func (*NonRecoverableError) Error ¶ added in v0.3.0
func (e *NonRecoverableError) Error() string
func (*NonRecoverableError) Unwrap ¶ added in v0.3.0
func (e *NonRecoverableError) Unwrap() error
type Object ¶
type Object struct {
// contains filtered or unexported fields
}
func NewObjectWithCapacity ¶
func (*Object) MakeIterator ¶
type OpCode ¶
type OpCode byte
const ( OpNop OpCode = iota OpJump OpJumpIfTrue OpJumpIfFalse OpDup OpPop OpCall OpNil OpNewClosure OpNewInt OpNewBool OpNewObject OpNewArray OpLoadGlobal OpLoadGlobalRef OpLoadGlobalDeref OpLoadLocal OpLoadLocalRef OpLoadLocalDeref OpCaptureLocal OpLoadArg OpLoadArgRef OpLoadArgDeref OpCaptureArg OpLoadCapture OpLoadCaptureRef OpLoadLiteral OpEvalBinOp OpNot OpUnaryMinus OpObjectPutNoPop OpObjectGet OpObjectGetRef OpArrayAppendNoPop OpRet OpStore OpInitCallFrame OpMakeIter OpBeginTry OpEndTry OpSwap OpThrow OpDefer OpNext OpSlice OpIterYield OpIterRet OpNewIter OpLiftArg OpInitLocal OpInitLiftedLocal OpInitGlobal OpInitLiftedGlobal )
type PackageSymbol ¶ added in v0.3.0
type PackageSymbol struct { Type PackageSymbolType Index uint32 }
type PackageSymbolType ¶ added in v0.3.0
type PackageSymbolType uint8
const ( PackageSymbolInvalid PackageSymbolType = iota PackageSymbolFunc PackageSymbolConst )
type RuntimeError ¶
func (*RuntimeError) Error ¶
func (e *RuntimeError) Error() string
func (*RuntimeError) Message ¶
func (e *RuntimeError) Message() string
func (*RuntimeError) String ¶
func (e *RuntimeError) String() string
func (*RuntimeError) Traits ¶ added in v0.3.0
func (e *RuntimeError) Traits() Traits
func (*RuntimeError) Type ¶
func (e *RuntimeError) Type() string
func (*RuntimeError) Unwrap ¶
func (e *RuntimeError) Unwrap() error
type String ¶
type String struct {
// contains filtered or unexported fields
}
func (String) MakeIterator ¶
func (String) MakeReader ¶
type VM ¶
type VM struct {
// contains filtered or unexported fields
}
func NewVM ¶
func NewVM(prog *CompiledPackage) *VM
func (*VM) GetCallerArgs ¶
func (*VM) GetCallerNArg ¶
func (*VM) GetFrameCrumb ¶
func (m *VM) GetFrameCrumb(n int) FrameCrumb
func (*VM) GetFrameInfo ¶
func (m *VM) GetFrameInfo(crumb FrameCrumb) FrameInfo
func (*VM) GetStackInfo ¶
func (*VM) GetUserData ¶
func (m *VM) GetUserData(key interface{}) interface{}
func (*VM) IsCallerPipeline ¶
func (*VM) IsPipeline ¶
func (*VM) PopContext ¶
func (*VM) PushContext ¶
func (*VM) RegisterCloser ¶
func (*VM) SetUserData ¶
func (m *VM) SetUserData(key, value interface{})
func (*VM) ShuttingDown ¶
func (*VM) SignalError ¶
func (*VM) StartCoroutine ¶
func (*VM) UnregisterCloser ¶
Click to show internal directories.
Click to hide internal directories.