Documentation ¶
Index ¶
- Constants
- Variables
- func CoerceToBool(v Value) bool
- func IsIterable(v Value) bool
- func IsReadable(v Value) bool
- func ToString(v Value) string
- func TypeName(v Value) string
- type Array
- func (a *Array) Add(v Value)
- func (a *Array) Back() Value
- func (a *Array) EvalOp(op Op, operand Value) (Value, error)
- 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) Type() string
- type BaseValue
- type Bool
- type Callable
- type CloseFn
- type Closer
- type Closure
- type Emitter
- func (e *Emitter) AddExternalFunc(fn NativeFn) int
- func (e *Emitter) AddGlobalParam(name string, global int) bool
- func (e *Emitter) AddLiteral(v Value) int
- func (e *Emitter) AddString(s string) 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) ToProgram() *Program
- type Float
- type Fn
- type FrameCrumb
- type FrameInfo
- type ILIterator
- type Indexable
- type Instr
- type Int
- type InvalidUsageError
- type Iterable
- type Iterator
- type Label
- type Location
- type NativeFn
- type NativeIterator
- type Object
- func (o *Object) Delete(key Value)
- func (o *Object) EvalOp(op Op, operand Value) (Value, error)
- 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) Type() string
- type Op
- type OpCode
- type Param
- type Program
- type Readable
- type Reader
- type Regex
- type RuntimeError
- func (e *RuntimeError) Error() string
- func (e *RuntimeError) EvalOp(op Op, operand Value) (Value, error)
- 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) Type() string
- func (e *RuntimeError) Unwrap() error
- type String
- func (s String) EvalOp(op Op, operand Value) (Value, error)
- func (s String) EvalUnaryMinus() (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) Type() string
- 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 ErrDivideByZero = errors.New("divide by zero")
View Source
var ErrIsNotIterable = errors.New("is not iterable")
View Source
var ErrIsNotReadable = errors.New("is not readable")
Functions ¶
func CoerceToBool ¶
func IsIterable ¶
func IsReadable ¶
Types ¶
type Array ¶
type Array struct {
// contains filtered or unexported fields
}
func NewArrayWithSlice ¶
func (*Array) MakeIterator ¶
type Emitter ¶
type Emitter struct {
// contains filtered or unexported fields
}
func NewEmitter ¶
func NewEmitter() *Emitter
func (*Emitter) AddExternalFunc ¶
func (*Emitter) AddLiteral ¶
func (*Emitter) ResolveLabel ¶
func (*Emitter) SetFuncMinArgs ¶
func (*Emitter) SetGlobalCount ¶
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) Type ¶
func (e *ILIterator) Type() string
type InvalidUsageError ¶
type InvalidUsageError struct {
// contains filtered or unexported fields
}
func NewInvalidUsageError ¶
func NewInvalidUsageError(expected string) *InvalidUsageError
func (*InvalidUsageError) Error ¶
func (e *InvalidUsageError) Error() string
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) EvalOp ¶
func (i *NativeIterator) EvalOp(op Op, operand Value) (Value, error)
func (*NativeIterator) IterNRet ¶
func (i *NativeIterator) IterNRet() int
func (*NativeIterator) String ¶
func (i *NativeIterator) String() string
func (*NativeIterator) Type ¶
func (i *NativeIterator) Type() string
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 OpLoadFn OpLoadNativeFn OpLoadLiteral OpEvalBinOp OpNot OpUnaryMinus OpObjectPutNoPop OpObjectGet OpObjectGetRef OpArrayAppendNoPop OpRet OpStore OpInitCallFrame OpMakeIter OpBeginTry OpEndTry OpSwap OpThrow OpDefer OpNext OpSlice OpIterYield OpIterRet OpNewIter OpLiftArg OpInitLiftedLocal OpInitLiftedGlobal )
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) 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) EvalUnaryMinus ¶
func (String) MakeIterator ¶
func (String) MakeReader ¶
type VM ¶
type VM struct {
// contains filtered or unexported fields
}
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.