Documentation ¶
Index ¶
- Constants
- Variables
- func ParseLine(commandA string) ([]string, error)
- func RunCode(scriptA string, optsA ...string) interface{}
- func RunInstr(p *VM, instrA *Instr) (resultR interface{})
- func Test()
- type ByteCode
- type CallStruct
- type DeepCallStruct
- type FuncContext
- type Instr
- type LoopStruct
- type OpCode
- type OpCodeNum
- type RangeStruct
- type VM
- func (p *VM) Errf(formatA string, argsA ...interface{}) error
- func (p *VM) GetCurrentFuncContext() *FuncContext
- func (p *VM) GetLabelIndex(inputA interface{}) int
- func (p *VM) GetVarValue(vA VarRef) interface{}
- func (p *VM) ParamsToInts(v *Instr, fromA int) []int
- func (p *VM) ParamsToList(v *Instr, fromA int) []interface{}
- func (p *VM) ParamsToStrs(v *Instr, fromA int) []string
- func (p *VM) Run(posA ...int) interface{}
- func (p *VM) RunDeferUpToRoot() error
- func (p *VM) RunOpCodes() (resultR interface{})
- func (p *VM) SetVar(refA VarRef, setValueA interface{}) error
- type VarRef
Constants ¶
View Source
const OpNameListG = `` /* 224-byte string literal not displayed */
Variables ¶
View Source
var DebugG = false
View Source
var InstrNameSet map[string]int = map[string]int{
"invalidInstr": 12,
"version": 100,
"pass": 101,
"testByText": 122,
"goto": 180,
"exit": 199,
"push": 220,
"peek": 222,
"pop": 224,
"=": 401,
"if": 610,
"<": 703,
"call": 1010,
"ret": 1020,
"getArrayItem": 1123,
"[]": 1123,
"now": 1910,
"pln": 10410,
"plo": 10411,
"pl": 10420,
"sleep": 20501,
"getClipText": 20511,
"setClipText": 20512,
"getEnv": 20521,
"setEnv": 20522,
"removeEnv": 20523,
"systemCmd": 20601,
"++i": 9999900011,
"--i": 9999900015,
"+i": 9999900101,
"-t": 9999900701,
}
instructions start
View Source
var OpNameMapG map[int]string = nil
View Source
var VersionG string = "0.0.1"
Functions ¶
Types ¶
type ByteCode ¶
type ByteCode struct { Source []string Labels map[string]int Consts []interface{} InstrList []Instr OpCodeList []OpCode // for trace InstrToLineMap map[int]int }
func (*ByteCode) DealInputParams ¶
func (*ByteCode) DealOutputParams ¶
func (*ByteCode) DeepCompile ¶
type CallStruct ¶
type DeepCallStruct ¶
type FuncContext ¶
type FuncContext struct { Vars []interface{} Tmp interface{} DeferStack *tk.SimpleStack }
func NewFuncContext ¶
func NewFuncContext() *FuncContext
func (*FuncContext) RunDefer ¶
func (p *FuncContext) RunDefer(vmA *VM) error
type LoopStruct ¶
type VM ¶
type VM struct { Code *ByteCode Regs []interface{} // the first(index 0) is always global vars map, the second is input param, the third is the return/output value Stack *tk.SimpleStack Vars []interface{} Seq *tk.Seq FuncStack *tk.SimpleStack CodePointer int InternalStack *tk.SimpleStack PointerStack *tk.SimpleStack ErrorHandler int }
func (*VM) GetCurrentFuncContext ¶
func (p *VM) GetCurrentFuncContext() *FuncContext
func (*VM) GetLabelIndex ¶
func (*VM) GetVarValue ¶
func (*VM) ParamsToList ¶
func (*VM) RunDeferUpToRoot ¶
func (*VM) RunOpCodes ¶
func (p *VM) RunOpCodes() (resultR interface{})
type VarRef ¶
type VarRef struct { Ref int // -99 - invalid, -56 - integer label, -31 - clipboard(text), -23 - slice of array/slice, -22 - map item, -21 - array/slice item, -18 - local reg, -17 - reg, -16 - label, -15 - ref, -12 - unref, -11 - seq, -10 - quickEval, -9 - flexEval, -8 - pop, -7 - peek, -6 - push, -5 - tmp, -4 - pln, -3 - value only, -2 - drop, -1 - debug, 3 normal vars Value interface{} }
Click to show internal directories.
Click to hide internal directories.