xie

package module
v0.0.0-...-5ea40ee Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var InstrNameSet map[string]int = map[string]int{

	"pass":      101,
	"debug":     102,
	"debugInfo": 103,
	"isUndef":   111,
	"goto":      180,
	"exit":      199,

	"push":  220,
	"push$": 221,
	"peek":  222,
	"peek$": 223,
	"pop":   224,
	"pop$":  225,
	"peek*": 226,
	"pop*":  227,

	"pushInt":  231,
	"pushInt$": 232,
	"pushInt#": 233,
	"pushInt*": 234,

	"global": 201,
	"var":    203,

	"regInt":  310,
	"regInt#": 312,

	"assign":    401,
	"assign$":   402,
	"assignInt": 410,
	"assignI":   411,

	"assignGlobal": 491,

	"if":     610,
	"if$":    611,
	"if*":    612,
	"ifNot$": 621,

	"==": 701,

	">i":  710,
	"<i":  720,
	"<i$": 721,
	"<i*": 722,

	"inc":      809,
	"inc$":     810,
	"dec$":     811,
	"dec*":     812,
	"intAdd":   820,
	"intAdd$":  821,
	"intDiv":   831,
	"floatAdd": 840,
	"floatDiv": 848,

	"call":     1010,
	"ret":      1020,
	"callFunc": 1050,
	"goFunc":   1060,

	"addItem":    1110,
	"addStrItem": 1111,

	"backQuote": 1501,
	"quote":     1503,
	"unquote":   1504,
	"trim":      1509,
	"isEmpty":   1510,
	"strAdd":    1520,

	"now":           1910,
	"nowStrCompact": 1911,
	"nowStr":        1912,
	"nowStrFormal":  1912,
	"timeSub":       1921,

	"getParam":       10001,
	"getSwitch":      10002,
	"ifSwitchExists": 10003,

	"pln":      10410,
	"plo":      10411,
	"pl":       10420,
	"plv":      10430,
	"plErr":    10440,
	"plErrStr": 10440,

	"convert":  10810,
	"convert$": 10811,

	"isErrStr":    10910,
	"getErrStr$":  10922,
	"checkErrStr": 10931,

	"writeResp": 20110,

	"getWeb": 20210,

	"htmlToText": 20310,

	"regReplaceAllStr$": 20411,

	"sleep": 20501,
}

Functions

func RunCode

func RunCode(codeA string, objA interface{}, optsA ...string) interface{}

Types

type FuncContext

type FuncContext struct {
	// VarsM          map[int]interface{}
	VarsLocalMapM  map[int]int
	VarsM          *[]interface{}
	ReturnPointerM int
	RegsM          Regs
}

type Instr

type Instr struct {
	Code     int
	ParamLen int
	Params   []VarRef
}

type Regs

type Regs struct {
	IntsM [5]int
	CondM bool
}

type UndefinedStruct

type UndefinedStruct struct {
	// contains filtered or unexported fields
}
var Undefined UndefinedStruct = UndefinedStruct{0}

func (UndefinedStruct) String

func (o UndefinedStruct) String() string

type VarRef

type VarRef struct {
	Ref   int // -8 - pop, -7 - peek, -5 - push, -3 - var(string), > 0 normal vars
	Value interface{}
}

type XieVM

type XieVM struct {
	SourceM        []string
	CodeListM      []string
	InstrListM     []Instr
	CodeSourceMapM map[int]int

	LabelsM      map[int]int
	VarIndexMapM map[string]int
	VarNameMapM  map[int]string

	CodePointerM int

	StackM []interface{}

	FuncStackM []FuncContext

	FuncContextM FuncContext

	CurrentFuncContextM *FuncContext
}

func NewXie

func NewXie(globalsA ...map[string]interface{}) *XieVM

func (*XieVM) CallFunc

func (p *XieVM) CallFunc(codeA string, argCountA int) string

func (*XieVM) Debug

func (p *XieVM) Debug()

func (*XieVM) ErrStrf

func (p *XieVM) ErrStrf(formatA string, argsA ...interface{}) string

func (*XieVM) GetRegs

func (p *XieVM) GetRegs() *Regs

func (*XieVM) GetValue

func (p *XieVM) GetValue(codeA int, vA interface{}) interface{}

func (*XieVM) GetVar

func (p *XieVM) GetVar(keyA string) interface{}

func (*XieVM) GetVarInt

func (p *XieVM) GetVarInt(keyA int) interface{}

func (*XieVM) GetVarRef

func (p *XieVM) GetVarRef(vA VarRef) *interface{}

func (*XieVM) GetVarValue

func (p *XieVM) GetVarValue(vA VarRef) interface{}

func (*XieVM) GetVarValueGlobal

func (p *XieVM) GetVarValueGlobal(vA VarRef) interface{}

func (*XieVM) GetVars

func (p *XieVM) GetVars() []interface{}

get current vars in context

func (*XieVM) GoFunc

func (p *XieVM) GoFunc(codeA string, argCountA int) string

func (*XieVM) InitVM

func (p *XieVM) InitVM(globalsA ...map[string]interface{})

func (*XieVM) Load

func (p *XieVM) Load(codeA string) string

func (*XieVM) ParseLine

func (p *XieVM) ParseLine(commandA string) ([]string, error)

func (*XieVM) ParseVar

func (p *XieVM) ParseVar(strA string) VarRef

func (*XieVM) Peek

func (p *XieVM) Peek() interface{}

func (*XieVM) Pop

func (p *XieVM) Pop() interface{}

func (*XieVM) PopFunc

func (p *XieVM) PopFunc() int

func (*XieVM) Pops

func (p *XieVM) Pops() string

func (*XieVM) Push

func (p *XieVM) Push(vA interface{})

func (*XieVM) PushFunc

func (p *XieVM) PushFunc()

func (*XieVM) PushVar

func (p *XieVM) PushVar(vA interface{})

func (*XieVM) Run

func (p *XieVM) Run(posA ...int) string

func (*XieVM) RunLine

func (p *XieVM) RunLine(lineA int) interface{}

func (*XieVM) SetVar

func (p *XieVM) SetVar(keyA string, vA interface{})

func (*XieVM) SetVarGlobal

func (p *XieVM) SetVarGlobal(keyA string, vA interface{})

func (*XieVM) SetVarInt

func (p *XieVM) SetVarInt(keyA int, vA interface{}) error

func (*XieVM) SetVarIntGlobal

func (p *XieVM) SetVarIntGlobal(keyA int, vA interface{}) error

Jump to

Keyboard shortcuts

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