Documentation ¶
Index ¶
- Variables
- func GetBytesBuildInMethod() map[string]*buildinMethod
- func GetCodeNumber(code *Code) (int, int, int, int)
- func GetIndexedVariableCount(v interface{}) int
- func GetMapBuildInMethod() map[string]*buildinMethod
- func GetNamedVariableCount(v interface{}) int
- func GetSliceBuildInMethod() map[string]*buildinMethod
- func GetStringBuildInMethod() map[string]*buildinMethod
- func GuessBasicType(vals ...interface{}) reflect.Type
- func GuessValuesKindToBasicType(vals ...*Value) reflect.Kind
- func GuessValuesTypeToBasicType(vals ...*Value) reflect.Type
- func ImportBinaryOperator(vmType YVMMode, flag OpcodeFlag, handler func(*Value, *Value) *Value)
- func ImportLuaBinaryOperator(flag OpcodeFlag, handler func(*Value, *Value) *Value)
- func ImportLuaUnaryOperator(flag OpcodeFlag, handler func(*Value) *Value)
- func ImportNaslBinaryOperator(flag OpcodeFlag, handler func(*Value, *Value) *Value)
- func ImportNaslUnaryOperator(flag OpcodeFlag, handler func(*Value) *Value)
- func ImportRuntimeLib(frame *Frame)
- func ImportUnaryOperator(vmType YVMMode, flag OpcodeFlag, handler func(*Value) *Value)
- func ImportYakBinaryOperator(flag OpcodeFlag, handler func(*Value, *Value) *Value)
- func ImportYakUnaryOperator(flag OpcodeFlag, handler func(*Value) *Value)
- func IsBytesOrRunes(v interface{}) bool
- func IsFloat(v interface{}) bool
- func IsInt(v interface{}) bool
- func IsUndefined(v *Value) bool
- func IsVMPanic(err error) bool
- func LuaVMValuesToFunctionMap(f *Function, vs []*Value) map[int]*Value
- func NewSwitchBundle() *switchBundle
- func OpcodeToName(op OpcodeFlag) string
- func OpcodesString(c []*Code) string
- func ShowOpcodes(c []*Code)
- func ShowOpcodesWithSource(src string, c []*Code)
- func YakVMValuesToFunctionMap(f *Function, vs []*Value, argumentCheck bool) map[int]*Value
- type BaseIterator
- type BreakPointFactoryFun
- type Breakpoint
- type BreakpointMap
- type ChannelIterator
- type Code
- type CodeState
- type CodesMarshaller
- func (c *CodesMarshaller) Marshal(tbl *SymbolTable, codes []*Code) ([]byte, error)
- func (c *CodesMarshaller) MarshalWithDebugInfo(tbl *SymbolTable, codes []*Code) ([]byte, error)
- func (c *CodesMarshaller) SetSourceCode(s string)
- func (c *CodesMarshaller) Unmarshal(buf []byte) (*SymbolTable, []*Code, error)
- type CompilerWrapperInterface
- type Coroutine
- type Debugger
- func (g *Debugger) Add()
- func (g *Debugger) AddBreakPointRef(b *Breakpoint) int
- func (g *Debugger) AddFrameRef(frame *Frame) int
- func (g *Debugger) AddObserveBreakPoint(expr string) error
- func (g *Debugger) AddObserveExpression(expr string) error
- func (g *Debugger) AddScopeRef(scope *Scope) int
- func (g *Debugger) AddVariableRef(v interface{}) int
- func (g *Debugger) Breakpoints() map[int]*Breakpoint
- func (g *Debugger) Callback()
- func (g *Debugger) ClearAllBreakPoints()
- func (g *Debugger) ClearBreakpointsInLine(lineIndex int)
- func (g *Debugger) ClearOtherBreakpointsWithSource(path string, existLines []int)
- func (g *Debugger) Codes() []*Code
- func (g *Debugger) CodesInState(state string) []*Code
- func (g *Debugger) Compile(code string) (*Frame, CompilerWrapperInterface, error)
- func (g *Debugger) CompileWithFrame(code string, frame *Frame) (*Frame, CompilerWrapperInterface, error)
- func (g *Debugger) CompileWithFrameID(code string, frameID int) (*Frame, CompilerWrapperInterface, error)
- func (g *Debugger) CurrentCodeIndex() int
- func (g *Debugger) CurrentFrameID() int
- func (g *Debugger) CurrentLine() int
- func (g *Debugger) CurrentStackTrace() *vmstack.Stack
- func (g *Debugger) CurrentStackTracePop()
- func (g *Debugger) CurrentThreadID() int
- func (g *Debugger) Description() string
- func (g *Debugger) DisableAllBreakPoints()
- func (g *Debugger) DisableBreakpointsInLine(lineIndex int)
- func (g *Debugger) EnableAllBreakPoints()
- func (g *Debugger) EnableBreakpointsInLine(lineIndex int)
- func (g *Debugger) EvalExpression(expr string) (*Value, error)
- func (g *Debugger) EvalExpressionWithFrameID(expr string, frameID int) (*Value, error)
- func (g *Debugger) ExistBreakPointInLineWithSource(path string, lineIndex int) (*Breakpoint, bool)
- func (g *Debugger) Finished() bool
- func (g *Debugger) ForceSetVariableRef(id int, v interface{})
- func (g *Debugger) Frame() *Frame
- func (g *Debugger) GetAllObserveBreakPoint() map[string]*Value
- func (g *Debugger) GetAllObserveExpressions() map[string]*Value
- func (g *Debugger) GetCode(state string, codeIndex int) *Code
- func (g *Debugger) GetLineFirstCode(lineIndex int) (*Code, int, string)
- func (g *Debugger) GetScopesByFrameID(frameID int) map[int]*Scope
- func (g *Debugger) GetStackTraces() map[int]*StackTraces
- func (g *Debugger) GetVariablesByRef(ref int) (interface{}, bool)
- func (g *Debugger) GetVariablesRef(v interface{}) (int, bool)
- func (g *Debugger) HandleForBreakPoint()
- func (g *Debugger) HandleForNormallyFinished()
- func (g *Debugger) HandleForPanic(vmPanic *VMPanic)
- func (g *Debugger) HandleForPause()
- func (g *Debugger) HandleForStepIn()
- func (g *Debugger) HandleForStepNext()
- func (g *Debugger) HandleForStepOut()
- func (g *Debugger) HitCount(breakpoint *Breakpoint) bool
- func (g *Debugger) InRootState() bool
- func (g *Debugger) Init(codes []*Code)
- func (g *Debugger) InitCallBack()
- func (g *Debugger) InitCode(codes []*Code)
- func (g *Debugger) IsPause() bool
- func (g *Debugger) NewBreakPoint(codeIndex, lineIndex int, condition, hitCondition, state string) *Breakpoint
- func (g *Debugger) Pause()
- func (g *Debugger) RemoveObserveBreakPoint(expr string) error
- func (g *Debugger) RemoveObserveExpression(expr string) error
- func (g *Debugger) ResetDescription()
- func (g *Debugger) ResetStopReason()
- func (g *Debugger) SetBreakPoint(lineIndex int, condition, hitCondition string) (int, error)
- func (g *Debugger) SetBreakPointWithSource(path string, lineIndex int, condition, hitCondition string) (int, error)
- func (g *Debugger) SetDescription(desc string)
- func (g *Debugger) SetFinished()
- func (g *Debugger) SetNormalBreakPoint(lineIndex int) (int, error)
- func (g *Debugger) SetStopReason(desc string)
- func (g *Debugger) SetVMPanic(p *VMPanic)
- func (g *Debugger) ShouldCallback(frame *Frame)
- func (g *Debugger) SourceCodeLines() []string
- func (g *Debugger) StartWGAdd()
- func (g *Debugger) StartWGDone()
- func (g *Debugger) StartWGWait()
- func (g *Debugger) State() string
- func (g *Debugger) StateName() string
- func (g *Debugger) StepIn() error
- func (g *Debugger) StepNext() error
- func (g *Debugger) StepOut() error
- func (g *Debugger) StopReason() string
- func (g *Debugger) SwitchByOtherFileOpcode(code *Code)
- func (g *Debugger) UpdateByFrame(frame *Frame)
- func (g *Debugger) VM() *VirtualMachine
- func (g *Debugger) VMPanic() *VMPanic
- func (g *Debugger) Wait()
- func (g *Debugger) WaitGroupDone()
- type DebuggerState
- type Defer
- type ExecFlag
- type ExitCodeType
- type Frame
- func (v *Frame) AutoConvertReflectValueByType(reflectValue *reflect.Value, targetType reflect.Type) error
- func (v *Frame) AutoConvertYakValueToNativeValue(val *Value) (reflect.Value, error)
- func (vm *Frame) CallLuaFunction(asyncCall bool, f *Function, vs []*Value) interface{}
- func (vm *Frame) CallYakFunction(asyncCall bool, f *Function, vs []*Value) interface{}
- func (v *Frame) CheckExit() error
- func (v *Frame) CreateAndSwitchSubScope(table *SymbolTable)
- func (v *Frame) CurrentCode() *Code
- func (v *Frame) CurrentScope() *Scope
- func (v *Frame) DebugExec(codes []*Code)
- func (v *Frame) EnableDebuggerEval()
- func (v *Frame) Exec(codes []*Code)
- func (v *Frame) ExitScope()
- func (v *Frame) ExitScopeWithCount(count int)
- func (v *Frame) GetCodes() []*Code
- func (v *Frame) GetContext() context.Context
- func (v *Frame) GetFunction() *Function
- func (v *Frame) GetLastStackValue() *Value
- func (v *Frame) GetVerbose() string
- func (v *Frame) GetVirtualMachine() *VirtualMachine
- func (v *Frame) NewScope(table *SymbolTable) *Scope
- func (v *Frame) NormalExec(codes []*Code)
- func (v *Frame) SetFunction(f *Function)
- func (v *Frame) SetOriginCode(s string)
- func (v *Frame) SetScope(scope *Scope)
- func (v *Frame) SetVerbose(s string)
- type Function
- func (f *Function) Copy(s *Scope) *Function
- func (f *Function) GetActualName() string
- func (f *Function) GetBindName() string
- func (f *Function) GetCodes() []*Code
- func (f *Function) GetName() string
- func (f *Function) GetNumIn() int
- func (f *Function) GetSymbolId() int
- func (f *Function) GetUUID() string
- func (f *Function) IsVariableParameter() bool
- func (f *Function) SetIsVariableParameter(v bool)
- func (f *Function) SetName(name string)
- func (f *Function) SetParamSymbols(i []int)
- func (f *Function) SetSourceCode(s string)
- func (f *Function) SetSymbol(id int)
- func (f *Function) String() string
- type IteratorInterface
- type IteratorType
- type LinesFirstCodeStateMap
- type MapIterator
- type MethodFactory
- func NewArrayMethodFactory(f func(*Frame, *Value, interface{}) interface{}) MethodFactory
- func NewBytesMethodFactory(f func([]byte) interface{}) MethodFactory
- func NewMapMethodFactory(f func(frame *Frame, v *Value) interface{}) MethodFactory
- func NewStringMethodFactory(f func(string) interface{}) MethodFactory
- type ObserveBreakPointMap
- type OpcodeFlag
- type OrderedMapIterator
- type PanicInfo
- type Reference
- type RepeatIterator
- type Scope
- func (s *Scope) CreateSubScope(table *SymbolTable) *Scope
- func (s *Scope) GetAllIdInScopes() []int
- func (s *Scope) GetAllNameAndValueInAllScopes() (results map[string]*Value)
- func (s *Scope) GetAllNameAndValueInScopes() (results map[string]*Value)
- func (s *Scope) GetIdByName(name string) int
- func (s *Scope) GetNameById(id int) string
- func (s *Scope) GetSymTable() *SymbolTable
- func (s *Scope) GetValueByID(id int) (*Value, bool)
- func (s *Scope) GetValueByName(name string) (*Value, bool)
- func (s *Scope) InCurrentScope(id int) bool
- func (s *Scope) IsRoot() bool
- func (s *Scope) Len() int
- func (s *Scope) NewValueByID(id int, v *Value)
- func (s *Scope) SetSymTable(symtbl *SymbolTable)
- func (s *Scope) SetVerbose(v string)
- type SliceIterator
- type StackTrace
- type StackTraces
- type SymbolTable
- func (s *SymbolTable) CreateSubSymbolTable(verbose ...string) *SymbolTable
- func (s *SymbolTable) GetLocalSymbolByVariableName(name string) (int, bool)
- func (s *SymbolTable) GetNameByVariableId(id int) (string, bool)
- func (s *SymbolTable) GetParentSymbolTable() *SymbolTable
- func (s *SymbolTable) GetRoot() (*SymbolTable, error)
- func (s *SymbolTable) GetSymbolByVariableName(name string) (int, bool)
- func (s *SymbolTable) GetSymbolTableById(id int) *SymbolTable
- func (s *SymbolTable) GetTableCount() int
- func (s *SymbolTable) GetTableIndex() int
- func (s *SymbolTable) IdIsInited(id int) bool
- func (s *SymbolTable) IsNew() bool
- func (s *SymbolTable) MustRoot() *SymbolTable
- func (s *SymbolTable) NewSymbolWithReturn(name string) (int, error)
- func (s *SymbolTable) NewSymbolWithoutName() int
- func (s *SymbolTable) SetIdIsInited(id int)
- type SymbolTableDesc
- type VMPanic
- type VMPanicSignal
- type Value
- func ChannelValueListToValue(op *Value) *Value
- func GetNaslValueBySymbolId(symbol int, frame *Frame) *Value
- func GetUndefined() *Value
- func NewAutoValue(b interface{}) *Value
- func NewBoolValue(b bool) *Value
- func NewEmptyMap(lit string) *Value
- func NewEmptyOMap(lit string) *Value
- func NewGeneralMap(lit string) *Value
- func NewGenericMap(lit string) *Value
- func NewIdentifierValue(i string) *Value
- func NewInt64Value(i int64) *Value
- func NewIntValue(i int) *Value
- func NewStringSliceValue(i []string) *Value
- func NewStringValue(i string) *Value
- func NewType(typeStr string, value reflect.Type) *Value
- func NewUndefined(id int) *Value
- func NewValue(typeStr string, value interface{}, lit string) *Value
- func NewValueRef(id int) *Value
- func NewValues(val []*Value) *Value
- func (v *Value) AddExtraInfo(key string, info interface{})
- func (v *Value) AsString() string
- func (_v *Value) Assign(vir *Frame, right *Value)
- func (v *Value) AssignBySymbol(table *Scope, val *Value)
- func (v *Value) AsyncCall(vm *Frame, wavy bool, vs ...*Value)
- func (v *Value) Bool() bool
- func (v *Value) Bytes() []byte
- func (v *Value) Call(vm *Frame, wavy bool, vs ...*Value) interface{}
- func (v *Value) CallLua(vm *Frame, vs ...*Value) interface{}
- func (v *Value) CallSliceIndex(i int) interface{}
- func (v *Value) Callable() bool
- func (v *Value) Codes() []*Code
- func (v *Value) ConvertToLeftValue() (*Value, error)
- func (_v *Value) Equal(value *Value) bool
- func (v *Value) False() bool
- func (v *Value) Float64() float64
- func (v *Value) GetExtraInfo(key string) interface{}
- func (v *Value) GetIndexedVariableCount() int
- func (v *Value) GetLeftCallerNIndex() (*Value, *Value)
- func (v *Value) GetNamedVariableCount() int
- func (v *Value) GetNativeCallFunctionName() string
- func (_v *Value) GlobalAssign(vir *Frame, right *Value)
- func (v *Value) GlobalAssignBySymbol(table *Scope, val *Value)
- func (v *Value) Int() int
- func (v *Value) Int64() int64
- func (v *Value) IntBool() bool
- func (v *Value) IsBool() bool
- func (v *Value) IsByte() bool
- func (v *Value) IsBytes() bool
- func (v *Value) IsBytesOrRunes() bool
- func (v *Value) IsChannel() bool
- func (v *Value) IsChannelValueList() bool
- func (v *Value) IsCodes() bool
- func (v *Value) IsFloat() bool
- func (v *Value) IsIdentifier() bool
- func (v *Value) IsInt() bool
- func (v *Value) IsInt64() bool
- func (v *Value) IsInt64EX() (int64, bool)
- func (v *Value) IsIterable() bool
- func (v *Value) IsLeftMemberCall() bool
- func (v *Value) IsLeftSliceCall() bool
- func (v *Value) IsLeftValueRef() bool
- func (v *Value) IsMap() bool
- func (v *Value) IsString() bool
- func (v *Value) IsStringOrBytes() bool
- func (v *Value) IsType() bool
- func (v *Value) IsUndefined() bool
- func (v *Value) IsValueList() bool
- func (v *Value) IsYakFunction() bool
- func (v *Value) LeftMemberAssignTo(vir *Frame, val *Value)
- func (v *Value) LeftSliceAssignTo(vir *Frame, val *Value)
- func (v *Value) Len() int
- func (v *Value) LuaFalse() bool
- func (v *Value) LuaFunctionNCall(vm *Frame, vs ...*Value) interface{}
- func (v *Value) LuaLeftSliceAssignTo(vir *Frame, val *Value)
- func (v *Value) LuaTrue() bool
- func (v *Value) NativeAsyncCall(vm *Frame, wavy bool, vs ...*Value) interface{}
- func (v *Value) NativeCall(vm *Frame, wavy bool, vs ...*Value) interface{}
- func (v *Value) NativeCallable() bool
- func (v *Value) Rangeable() bool
- func (v *Value) String() string
- func (v *Value) True() bool
- func (v *Value) Type() reflect.Type
- func (v *Value) TypeStr() string
- func (v *Value) ValueList() []*Value
- func (v *Value) ValueListToInterface() interface{}
- func (v *Value) YakFunctionNAsyncCall(vm *Frame, vs ...*Value)
- func (v *Value) YakFunctionNCall(vm *Frame, vs ...*Value) interface{}
- type VirtualMachine
- func (v *VirtualMachine) AddBreakPoint(fun BreakPointFactoryFun)
- func (v *VirtualMachine) AsyncEnd()
- func (v *VirtualMachine) AsyncStart()
- func (v *VirtualMachine) AsyncWait()
- func (v *VirtualMachine) CurrentFM() *Frame
- func (v *VirtualMachine) Exec(ctx context.Context, f func(frame *Frame), flags ...ExecFlag) error
- func (v *VirtualMachine) ExecAsyncYakFunction(ctx context.Context, f *Function, args map[int]*Value) error
- func (v *VirtualMachine) ExecYakCode(ctx context.Context, sourceCode string, codes []*Code, flags ...ExecFlag) error
- func (v *VirtualMachine) ExecYakFunction(ctx context.Context, f *Function, args map[int]*Value, flags ...ExecFlag) (interface{}, error)
- func (v *VirtualMachine) GetConfig() *VirtualMachineConfig
- func (n *VirtualMachine) GetDebugger() *Debugger
- func (n *VirtualMachine) GetExternalVariableNames() []string
- func (n *VirtualMachine) GetGlobalVar() *limitedmap.ReadOnlyMap
- func (n *VirtualMachine) GetNaslGlobalVarTable() (map[int]*Value, error)
- func (n *VirtualMachine) GetRuntimeGlobalVar() *limitedmap.SafeMap
- func (n *VirtualMachine) GetVar(name string) (interface{}, bool)
- func (n *VirtualMachine) GetVarWithoutFrame(name string) (any, bool)
- func (n *VirtualMachine) ImportLibs(libs map[string]interface{})
- func (v *VirtualMachine) InlineExecYakCode(ctx context.Context, codes []*Code, flags ...ExecFlag) error
- func (n *VirtualMachine) RegisterGlobalVariableFallback(h func(string) interface{})
- func (n *VirtualMachine) RegisterMapMemberCallHandler(caller, callee string, h func(interface{}) interface{})
- func (v *VirtualMachine) SetConfig(config *VirtualMachineConfig)
- func (v *VirtualMachine) SetDebug(debug bool)
- func (v *VirtualMachine) SetDebugMode(debug bool, sourceCode string, codes []*Code, ...)
- func (v *VirtualMachine) SetSandboxMode(mode bool)
- func (v *VirtualMachine) SetSymboltable(table *SymbolTable)
- func (n *VirtualMachine) SetVars(m map[string]any)
- type VirtualMachineConfig
- func (c *VirtualMachineConfig) GetClosureSupport() bool
- func (c *VirtualMachineConfig) GetFunctionNumberCheck() bool
- func (c *VirtualMachineConfig) GetStopRecover() bool
- func (c *VirtualMachineConfig) SetClosureSupport(b bool)
- func (c *VirtualMachineConfig) SetFunctionNumberCheck(b bool)
- func (c *VirtualMachineConfig) SetStopRecover(b bool)
- func (c *VirtualMachineConfig) SetYVMMode(mode YVMMode)
- type YVMMode
- type YakitFeedbacker
Constants ¶
This section is empty.
Variables ¶
View Source
var IdtoSymbolTable = new(sync.Map)
View Source
var OpcodeVerboseName = map[OpcodeFlag]string{ OpBitwiseNot: `not`, OpAnd: `and`, OpAndNot: `and-not`, OpOr: `or`, OpXor: `xor`, OpShl: `shl`, OpShr: `shr`, OpTypeCast: `type-cast`, OpPlusPlus: `self-add-one`, OpMinusMinus: `self-minus-one`, OpNot: `bang`, OpNeg: `neg`, OpPlus: `plus`, OpChan: `chan-recv`, OpAdd: `add`, OpSub: `sub`, OpMod: `mod`, OpMul: `mul`, OpDiv: `div`, OpGt: `gt`, OpLt: `lt`, OpLtEq: `lt-eq`, OpGtEq: `gt-eq`, OpNotEq: `neq`, OpEq: `eq`, OpPlusEq: `self-plus-eq`, OpMinusEq: `self-minus-eq`, OpMulEq: `self-mul-eq`, OpDivEq: `self-div-eq`, OpModEq: `self-mod-eq`, OpAndEq: `self-and-eq`, OpOrEq: `self-or-eq`, OpXorEq: `self-xor-eq`, OpShlEq: `self-shl-eq`, OpShrEq: `self-shr-eq`, OpAndNotEq: `self-and-not-eq`, OpIn: `in`, OpSendChan: `chan-send`, OpRangeNext: `range-next`, OpInNext: `in-next`, OpEnterFR: `enter-for-range`, OpExitFR: `exit-for-range`, OpType: `type`, OpMake: `make`, OpPush: `push`, OpList: `list`, OpAssign: `assign`, OpFastAssign: `fast-assign`, OpPushRef: `pushr`, OpPushLeftRef: `pushleftr`, OpJMP: `jmp`, OpJMPT: `jmpt`, OpJMPF: `jmpf`, OpJMPTOP: `jmpt-or-pop`, OpJMPFOP: `jmpf-or-pop`, OpCall: `call`, OpVariadicCall: `callvar`, OpPushId: `pushid`, OpPop: `pop`, OpPushfuzz: `pushf`, OpNewMap: `newmap`, OpNewMapWithType: `typedmap`, OpNewSlice: `newslice`, OpNewSliceWithType: `typedslice`, OpIterableCall: `iterablecall`, OpReturn: `return`, OpAssert: `assert`, OpDefer: `defer`, OpMemberCall: `membercall`, OpBreak: `break`, OpContinue: `continue`, OpAsyncCall: "async-call", OpScope: `new-scope`, OpScopeEnd: `end-scope`, OpInclude: `include`, OpRecover: `recover`, OpPanic: `panic`, OpEllipsis: `ellipsis`, OpCatchError: `catch-error`, OpStopCatchError: `stop-catch-error`, OpExit: `exit`, }
Functions ¶
func GetBytesBuildInMethod ¶ added in v1.2.9
func GetBytesBuildInMethod() map[string]*buildinMethod
func GetIndexedVariableCount ¶ added in v1.2.6
func GetIndexedVariableCount(v interface{}) int
func GetMapBuildInMethod ¶
func GetMapBuildInMethod() map[string]*buildinMethod
func GetNamedVariableCount ¶ added in v1.2.6
func GetNamedVariableCount(v interface{}) int
func GetSliceBuildInMethod ¶
func GetSliceBuildInMethod() map[string]*buildinMethod
func GetStringBuildInMethod ¶
func GetStringBuildInMethod() map[string]*buildinMethod
var _title = http.CanonicalHeaderKey
func GuessBasicType ¶
func GuessValuesKindToBasicType ¶
func ImplicitTypeConversionForPlus(vals ...*Value) reflect.Type { resultType := GuessValuesTypeToBasicType(vals...) if resultType.Kind() == literalReflectType_Interface.Kind() { isString := true for _, val := range vals { if !val.IsString() && !val.IsInt() { isString = false break } } if isString { resultType = literalReflectType_String } } return resultType }
func ImportBinaryOperator ¶
func ImportBinaryOperator(vmType YVMMode, flag OpcodeFlag, handler func(*Value, *Value) *Value)
func ImportLuaBinaryOperator ¶ added in v1.2.3
func ImportLuaBinaryOperator(flag OpcodeFlag, handler func(*Value, *Value) *Value)
lua
func ImportLuaUnaryOperator ¶ added in v1.2.3
func ImportLuaUnaryOperator(flag OpcodeFlag, handler func(*Value) *Value)
func ImportNaslBinaryOperator ¶ added in v1.2.3
func ImportNaslBinaryOperator(flag OpcodeFlag, handler func(*Value, *Value) *Value)
nasl
func ImportNaslUnaryOperator ¶ added in v1.2.3
func ImportNaslUnaryOperator(flag OpcodeFlag, handler func(*Value) *Value)
func ImportRuntimeLib ¶ added in v1.2.8
func ImportRuntimeLib(frame *Frame)
func ImportUnaryOperator ¶
func ImportUnaryOperator(vmType YVMMode, flag OpcodeFlag, handler func(*Value) *Value)
func ImportYakBinaryOperator ¶ added in v1.2.3
func ImportYakBinaryOperator(flag OpcodeFlag, handler func(*Value, *Value) *Value)
yak
func ImportYakUnaryOperator ¶ added in v1.2.3
func ImportYakUnaryOperator(flag OpcodeFlag, handler func(*Value) *Value)
func IsBytesOrRunes ¶ added in v1.2.6
func IsBytesOrRunes(v interface{}) bool
func IsInt ¶
func IsInt(v interface{}) bool
关于类型的描述,我们通过一些简单的方式可以保证
- 在 golang => yak 的时候,清理到不好的类型,比如 uint 与 float32,其他的类型均是可以接受的 但是因为有限的情况下,int64 和 int 是可以接受的,但是再大就有点小问题了(需要注意的是,一般 x64 系统中,int64 和 int 是一样的)
- 所以在计算过程中 yak => golang 的过程中,我们不希望调用到任何 uint 类型的东西
func IsUndefined ¶
func NewSwitchBundle ¶ added in v1.2.6
func NewSwitchBundle() *switchBundle
func OpcodeToName ¶
func OpcodeToName(op OpcodeFlag) string
func OpcodesString ¶
func ShowOpcodes ¶
func ShowOpcodes(c []*Code)
func ShowOpcodesWithSource ¶ added in v1.2.3
Types ¶
type BaseIterator ¶
type BaseIterator struct {
Current, N int
// contains filtered or unexported fields
}
func (*BaseIterator) IsEnd ¶
func (i *BaseIterator) IsEnd() bool
func (*BaseIterator) Next ¶
func (i *BaseIterator) Next() (data []interface{}, hadEnd bool)
func (*BaseIterator) Type ¶
func (i *BaseIterator) Type() IteratorType
type BreakPointFactoryFun ¶
type BreakPointFactoryFun func(v *VirtualMachine) bool
type Breakpoint ¶
type Breakpoint struct { ID int On bool CodeIndex, LineIndex int Condition, HitCondition string State string HitCount int // 命中次数 }
func (*Breakpoint) Disable ¶
func (bp *Breakpoint) Disable()
func (*Breakpoint) Enable ¶
func (bp *Breakpoint) Enable()
type BreakpointMap ¶ added in v1.2.6
type BreakpointMap = map[int]*Breakpoint
type ChannelIterator ¶
type ChannelIterator struct { BaseIterator // contains filtered or unexported fields }
func (*ChannelIterator) Next ¶
func (i *ChannelIterator) Next() (data []interface{}, hadEnd bool)
type Code ¶
type Code struct { Opcode OpcodeFlag Unary int Op1 *Value Op2 *Value // 记录 Opcode 的位置 SourceCodeFilePath *string SourceCodePointer *string StartLineNumber int StartColumnNumber int EndLineNumber int EndColumnNumber int }
func (*Code) GetJmpIndex ¶
func (*Code) RangeVerbose ¶
type CodeState ¶
type CodeState struct {
// contains filtered or unexported fields
}
func NewCodeState ¶
type CodesMarshaller ¶
type CodesMarshaller struct {
// contains filtered or unexported fields
}
func NewCodesMarshaller ¶
func NewCodesMarshaller() *CodesMarshaller
func (*CodesMarshaller) Marshal ¶
func (c *CodesMarshaller) Marshal(tbl *SymbolTable, codes []*Code) ([]byte, error)
func (*CodesMarshaller) MarshalWithDebugInfo ¶
func (c *CodesMarshaller) MarshalWithDebugInfo(tbl *SymbolTable, codes []*Code) ([]byte, error)
func (*CodesMarshaller) SetSourceCode ¶ added in v1.2.3
func (c *CodesMarshaller) SetSourceCode(s string)
func (*CodesMarshaller) Unmarshal ¶
func (c *CodesMarshaller) Unmarshal(buf []byte) (*SymbolTable, []*Code, error)
type CompilerWrapperInterface ¶
type CompilerWrapperInterface interface { NewWithSymbolTable(*SymbolTable) CompilerWrapperInterface Compiler(code string) bool GetNormalErrors() (bool, error) GetOpcodes() []*Code }
var ( // 由yakast包注入 YakDebugCompiler CompilerWrapperInterface )
type Coroutine ¶ added in v1.3.0
type Coroutine struct {
// contains filtered or unexported fields
}
func NewCoroutine ¶ added in v1.3.0
func NewCoroutine() *Coroutine
type Debugger ¶
type Debugger struct { // 堆栈跟踪 StackTraces map[int]*vmstack.Stack // threadID -> stacktraces ThreadStackTrace map[int]*DebuggerState // 每个线程对应的当前的stackTrace // Reference,用于存储帧,作用域,变量引用的信息 Reference *Reference // contains filtered or unexported fields }
func NewDebugger ¶
func NewDebugger(vm *VirtualMachine, sourceCode string, codes []*Code, init, callback func(*Debugger)) *Debugger
func (*Debugger) AddBreakPointRef ¶ added in v1.2.6
func (g *Debugger) AddBreakPointRef(b *Breakpoint) int
func (*Debugger) AddFrameRef ¶ added in v1.2.6
func (*Debugger) AddObserveBreakPoint ¶
func (*Debugger) AddObserveExpression ¶
func (*Debugger) AddScopeRef ¶ added in v1.2.6
func (*Debugger) AddVariableRef ¶ added in v1.2.6
func (*Debugger) Breakpoints ¶
func (g *Debugger) Breakpoints() map[int]*Breakpoint
func (*Debugger) ClearAllBreakPoints ¶
func (g *Debugger) ClearAllBreakPoints()
func (*Debugger) ClearBreakpointsInLine ¶
func (*Debugger) ClearOtherBreakpointsWithSource ¶ added in v1.2.6
func (*Debugger) CodesInState ¶ added in v1.2.4
func (*Debugger) Compile ¶
func (g *Debugger) Compile(code string) (*Frame, CompilerWrapperInterface, error)
func (*Debugger) CompileWithFrame ¶ added in v1.2.6
func (*Debugger) CompileWithFrameID ¶ added in v1.2.6
func (*Debugger) CurrentCodeIndex ¶
func (*Debugger) CurrentFrameID ¶ added in v1.2.6
func (*Debugger) CurrentLine ¶
func (*Debugger) CurrentStackTrace ¶ added in v1.2.6
func (*Debugger) CurrentStackTracePop ¶ added in v1.2.6
func (g *Debugger) CurrentStackTracePop()
func (*Debugger) CurrentThreadID ¶ added in v1.2.6
func (*Debugger) Description ¶
func (*Debugger) DisableAllBreakPoints ¶
func (g *Debugger) DisableAllBreakPoints()
func (*Debugger) DisableBreakpointsInLine ¶
func (*Debugger) EnableAllBreakPoints ¶
func (g *Debugger) EnableAllBreakPoints()
func (*Debugger) EnableBreakpointsInLine ¶
func (*Debugger) EvalExpressionWithFrameID ¶ added in v1.2.6
func (*Debugger) ExistBreakPointInLineWithSource ¶ added in v1.2.6
func (g *Debugger) ExistBreakPointInLineWithSource(path string, lineIndex int) (*Breakpoint, bool)
func (*Debugger) ForceSetVariableRef ¶ added in v1.2.6
func (*Debugger) GetAllObserveBreakPoint ¶ added in v1.2.6
func (*Debugger) GetAllObserveExpressions ¶
func (*Debugger) GetLineFirstCode ¶
func (*Debugger) GetScopesByFrameID ¶ added in v1.2.6
func (*Debugger) GetStackTraces ¶ added in v1.2.6
func (g *Debugger) GetStackTraces() map[int]*StackTraces
func (*Debugger) GetVariablesByRef ¶ added in v1.2.6
func (*Debugger) GetVariablesRef ¶ added in v1.2.6
func (*Debugger) HandleForBreakPoint ¶ added in v1.2.6
func (g *Debugger) HandleForBreakPoint()
func (*Debugger) HandleForNormallyFinished ¶ added in v1.2.6
func (g *Debugger) HandleForNormallyFinished()
func (*Debugger) HandleForPanic ¶ added in v1.2.6
func (*Debugger) HandleForPause ¶ added in v1.2.6
func (g *Debugger) HandleForPause()
func (*Debugger) HandleForStepIn ¶
func (g *Debugger) HandleForStepIn()
func (*Debugger) HandleForStepNext ¶
func (g *Debugger) HandleForStepNext()
func (*Debugger) HandleForStepOut ¶
func (g *Debugger) HandleForStepOut()
func (*Debugger) HitCount ¶ added in v1.2.6
func (g *Debugger) HitCount(breakpoint *Breakpoint) bool
func (*Debugger) InRootState ¶
func (*Debugger) InitCallBack ¶
func (g *Debugger) InitCallBack()
func (*Debugger) NewBreakPoint ¶ added in v1.2.6
func (g *Debugger) NewBreakPoint(codeIndex, lineIndex int, condition, hitCondition, state string) *Breakpoint
func (*Debugger) RemoveObserveBreakPoint ¶
func (*Debugger) RemoveObserveExpression ¶
func (*Debugger) ResetDescription ¶
func (g *Debugger) ResetDescription()
func (*Debugger) ResetStopReason ¶ added in v1.2.6
func (g *Debugger) ResetStopReason()
func (*Debugger) SetBreakPoint ¶
func (*Debugger) SetBreakPointWithSource ¶ added in v1.2.6
func (*Debugger) SetDescription ¶ added in v1.2.6
func (*Debugger) SetFinished ¶ added in v1.2.6
func (g *Debugger) SetFinished()
func (*Debugger) SetNormalBreakPoint ¶
func (*Debugger) SetStopReason ¶ added in v1.2.6
func (*Debugger) SetVMPanic ¶ added in v1.2.6
func (*Debugger) ShouldCallback ¶ added in v1.2.6
func (*Debugger) SourceCodeLines ¶
func (*Debugger) StartWGAdd ¶ added in v1.2.6
func (g *Debugger) StartWGAdd()
func (*Debugger) StartWGDone ¶ added in v1.2.6
func (g *Debugger) StartWGDone()
func (*Debugger) StartWGWait ¶ added in v1.2.6
func (g *Debugger) StartWGWait()
func (*Debugger) StopReason ¶ added in v1.2.6
func (*Debugger) SwitchByOtherFileOpcode ¶ added in v1.2.6
func (*Debugger) UpdateByFrame ¶ added in v1.2.4
func (*Debugger) VM ¶
func (g *Debugger) VM() *VirtualMachine
func (*Debugger) WaitGroupDone ¶
func (g *Debugger) WaitGroupDone()
type DebuggerState ¶ added in v1.2.6
type DebuggerState struct {
// contains filtered or unexported fields
}
type ExitCodeType ¶
type ExitCodeType int
const ( ErrorExit ExitCodeType = 1 << iota NormallyExit NoneExit TryExit ReturnExit )
type Frame ¶
type Frame struct { // 运算符的 Opcode BinaryOperatorTable map[OpcodeFlag]func(*Value, *Value) *Value UnaryOperatorTable map[OpcodeFlag]func(*Value) *Value // yak函数, 内置函数,乃至变量聚集地 GlobalVariables *limitedmap.SafeMap ThreadID int // 当前线程的ID // contains filtered or unexported fields }
func NewFrame ¶
func NewFrame(vm *VirtualMachine) *Frame
func NewSubFrame ¶
func (*Frame) AutoConvertReflectValueByType ¶
func (*Frame) AutoConvertYakValueToNativeValue ¶
func (*Frame) CallLuaFunction ¶
func (*Frame) CallYakFunction ¶
func (*Frame) CreateAndSwitchSubScope ¶
func (v *Frame) CreateAndSwitchSubScope(table *SymbolTable)
func (*Frame) CurrentCode ¶
func (*Frame) CurrentScope ¶
func (*Frame) EnableDebuggerEval ¶
func (v *Frame) EnableDebuggerEval()
func (*Frame) ExitScopeWithCount ¶
func (*Frame) GetContext ¶
func (*Frame) GetFunction ¶
func (*Frame) GetLastStackValue ¶
func (*Frame) GetVerbose ¶
func (*Frame) GetVirtualMachine ¶
func (v *Frame) GetVirtualMachine() *VirtualMachine
func (*Frame) NewScope ¶
func (v *Frame) NewScope(table *SymbolTable) *Scope
func (*Frame) NormalExec ¶
func (*Frame) SetFunction ¶
func (*Frame) SetOriginCode ¶ added in v1.2.3
func (*Frame) SetVerbose ¶
type Function ¶
type Function struct { FreeValue []int // contains filtered or unexported fields }
func NewFunction ¶
func NewFunction(codes []*Code, tbl *SymbolTable) *Function
func (*Function) GetActualName ¶
func (*Function) GetBindName ¶
func (*Function) GetSymbolId ¶
func (*Function) IsVariableParameter ¶
func (*Function) SetIsVariableParameter ¶
func (*Function) SetParamSymbols ¶
func (*Function) SetSourceCode ¶ added in v1.2.3
type IteratorInterface ¶
type IteratorInterface interface { IsEnd() bool Next() (data []interface{}, hadEnd bool) Type() IteratorType }
func NewIterator ¶
func NewIterator(i interface{}, v *Frame) (IteratorInterface, error)
type IteratorType ¶
type IteratorType int
const ( SliceIteratorType IteratorType = iota MapIteratorType ChannelIteratorType RepeatIteratorType )
type LinesFirstCodeStateMap ¶ added in v1.2.6
type MapIterator ¶
type MapIterator struct { BaseIterator // contains filtered or unexported fields }
func (*MapIterator) Next ¶
func (i *MapIterator) Next() (data []interface{}, hadEnd bool)
type MethodFactory ¶
type MethodFactory func(*Frame, interface{}) interface{}
func NewArrayMethodFactory ¶
func NewArrayMethodFactory(f func(*Frame, *Value, interface{}) interface{}) MethodFactory
func NewBytesMethodFactory ¶
func NewBytesMethodFactory(f func([]byte) interface{}) MethodFactory
func NewMapMethodFactory ¶
func NewMapMethodFactory(f func(frame *Frame, v *Value) interface{}) MethodFactory
func NewStringMethodFactory ¶
func NewStringMethodFactory(f func(string) interface{}) MethodFactory
type ObserveBreakPointMap ¶ added in v1.2.6
type OpcodeFlag ¶
type OpcodeFlag int
const ( OpNop OpcodeFlag = iota // OpTypeCast 从栈中取出两个值,第一个值为类型,第二个值为具体需要转换的值,进行类型转换,并把结果推入栈中 OpTypeCast // type convert // Unary OpNot // ! OpNeg // - OpPlus // + OpChan // <- OpPlusPlus // ++ OpMinusMinus // -- // Binary OpShl // << OpShr // >> OpAnd // & OpAndNot // &^ OpOr // | OpXor // ^ OpAdd // + OpSub // - OpMul // * OpDiv // / OpMod // % OpGt // > OpLt // < OpGtEq // >= OpLtEq // <= OpEq // == OpNotEq // != <> OpPlusEq // += OpMinusEq // -= OpMulEq // *= OpDivEq // /= OpModEq // %= OpAndEq // &= OpOrEq // |= OpXorEq // ^= OpShlEq // <<= OpShrEq // >>= OpAndNotEq // &^= OpIn // in OpSendChan // <- OpType // type OpMake // make OpPush // 把一个 Op1 压入栈 OpPushfuzz // 把一个 Op1,执行 Fuzz String 操作,并且压入栈 /* for range 和 for in 需要对右值表达式结果进行迭代,需要配合 Op 实现 */ OpRangeNext // 从栈中取出一个元素,然后迭代, 并且压入栈 OpInNext // 从栈中取出一个元素,然后迭代, 并且压入栈, 与range稍微有点区别,比如可以解包slice以及迭代slice时第一个值时value而不是index OpEnterFR // 进入for range, 从栈中peek值创建迭代器,并往IteratorStack栈中压入迭代器 OpExitFR // 退出for range, 判断IteratorStack是否已经结束,如果未结束则跳到for range开头(Unary),否则将pop IteratorStack并继续执行后续代码 OpList // 这个操作有一个参数,从栈中取多少个元素组成 list,用 unary: int 标记 // OpAssign 这个操作有两个参数 // 左右值一般都会是 ValueList,所以 TypeVerbose 为 list, 将会设定类型断言 []*Value // popArgN 后,0 为右值,1 为左值 OpAssign // OpFastAssign 快速赋值,存在于特殊的赋值中 // 从栈中取两个值,arg1 为符号左,arg2 为具体值 // 进行快速赋值,直接把值赋值给符号左,并且把 arg2 继续压入栈 OpFastAssign // push 一个符号对应的值,这个值没有操作数 op1 op2 只操作 unary OpPushRef // 左值引用,是一个专属 push 一般用于赋值需要替换 **Value 的时候 // 这个只操作了 Unary,Unary 传递具体的符号 OpPushLeftRef // 除了跳转指令之外,其他指令都不应该直接操作 index! // JMP 无条件跳转到第几条指令,unary 记录指令数 OpJMP // 从栈中取出一个值,如果值为 true 跳转到 unary 的指令中 OpJMPT // 从栈中取出一个值,值为 false 跳转到 unary 的指令中 OpJMPF // 从栈中查看最近的一个值,值为 true 则跳转到 unary 位置,否则 pop 出栈数据 OpJMPTOP // 从栈中查看最近的一个值,值为 false 则跳转到 unary 位置,否则 pop 出栈数据 OpJMPFOP // OpBreak 这个语句是为 break 设置的语句,一般是用来记录跳转到的位置,基本等同于 JMP // 不一样的是 Break 的位置,其实是无法事先预知的, // 所以需要 for 循环结束的最后一步,去寻找当前 for 循环中没有被设置过的 break 语句 // 没有被设置之前,Unary 应该是小于等于零的 // 因为 Break 也操作了指针,所以 OpBreak 结束后也不应该操作指针 // // 和 JMP 不一样的地方是,Break/Continue 会破坏 scope 栈的平衡 // 所以,这两个执行的时候,需要附带栈推出 OpBreak OpContinue // OpCall / OpVariadicCall 从 unary 中取应该 pop 多少个数 // 并且再重栈中 pop 出应该调用的内容 OpCall OpVariadicCall /*这个是针对可变参数的调用*/ // OpPushId push 一个引用名字,这个名字可能是无法获取到符号表中的符号,但是被使用了 // 所以这个不能使用 unary,使用 op1 类型为 Identifier 作为操作数,找不到就是 nil 或者 undefined OpPushId // OpPop 一般用于维持栈平衡,比如说 push 一个表达式语句,一般不会 pop,需要用 OpPop 来弹出 OpPop // OpNewMap 这个指令用于创建一个 map,从栈中取出 unary * 2 个数据,然后俩俩组合,左边为 key 右边为 value OpNewMap // OpNewMapWithType 这个指令用于创建一个 map,从栈中取出 unary * 2 个数据,然后俩俩组合,左边为 key 右边为 value, 再取出 Type,组合成 Map OpNewMapWithType // OpNewSlice 用于从栈中创建 Slice,取出 unary 个数据,推断类型,然后组合成 slice OpNewSlice // OpNewSliceWithType 从栈中创建 Slice,取出 unary 个操作数,再取出 Type,组合成 Slice OpNewSliceWithType // OpSliceCall 索引Silice OpIterableCall // OpReturn 从栈取一个数据出来,复制给返回值缓存数据,一般来说,可以用 lastStackValue 来取数 OpReturn // OpDefer 执行 op1,一般 op1 的值必须是 codes 也就是 []*Opcode // 作为虚拟机退出的时候需要执行的值 OpDefer // OpAssert 从栈中取出几一个或两个参数,然后断言类型,如果是false,就 panic参数第二个参数 OpAssert // OpMemberCall 获取map或结构体的成员变量或方法 OpMemberCall // OpAsyncCall 执行 goroutine // unary 为 OpAsyncCall // OpScope 会新创建一个定义域,通过 OpScopeEnd 来停止定义域 // 定义域是一个树形结构,保存了父定义域的引用,因为需要看到父定义域的内容 OpScope OpScopeEnd // include 会直接从栈中pop文件路径然后执行 OpInclude // OpPanic 主动 panic 掉,然后把错误交给 Defer 的 Recover 实现 OpPanic OpRecover // OpEllipsis 函数不定参数调用拆包 OpEllipsis // OpBitwiseNot 按位取反 OpBitwiseNot OpCatchError OpStopCatchError OpExit )
func (OpcodeFlag) IsJmp ¶
func (f OpcodeFlag) IsJmp() bool
type OrderedMapIterator ¶ added in v1.3.3
type OrderedMapIterator struct { BaseIterator // contains filtered or unexported fields }
func (*OrderedMapIterator) Next ¶ added in v1.3.3
func (i *OrderedMapIterator) Next() (data []interface{}, hadEnd bool)
type PanicInfo ¶
type PanicInfo struct {
// contains filtered or unexported fields
}
func (*PanicInfo) SetPositionVerbose ¶ added in v1.2.8
type Reference ¶ added in v1.2.6
type Reference struct { FrameHM *frameHandlesMap BreakPointHM *breakPointHandlesMap VarHM *handlesMap // 这里会存储Scope, yakvm.Value, 或者golang的value }
func NewReference ¶ added in v1.2.6
func NewReference() *Reference
type RepeatIterator ¶
type RepeatIterator struct {
BaseIterator
}
func (*RepeatIterator) Next ¶
func (i *RepeatIterator) Next() (data []interface{}, hadEnd bool)
type Scope ¶
type Scope struct {
// contains filtered or unexported fields
}
func NewScope ¶
func NewScope(table *SymbolTable) *Scope
NewScope Create Root Scope NewVirtualMachine Called Generally
func (*Scope) CreateSubScope ¶
func (s *Scope) CreateSubScope(table *SymbolTable) *Scope
func (*Scope) GetAllIdInScopes ¶
func (*Scope) GetAllNameAndValueInAllScopes ¶
func (*Scope) GetAllNameAndValueInScopes ¶
func (*Scope) GetIdByName ¶ added in v1.2.6
func (*Scope) GetNameById ¶
func (*Scope) GetSymTable ¶
func (s *Scope) GetSymTable() *SymbolTable
func (*Scope) InCurrentScope ¶
func (*Scope) NewValueByID ¶
func (*Scope) SetSymTable ¶
func (s *Scope) SetSymTable(symtbl *SymbolTable)
func (*Scope) SetVerbose ¶
type SliceIterator ¶
type SliceIterator struct { BaseIterator // contains filtered or unexported fields }
func (*SliceIterator) Next ¶
func (i *SliceIterator) Next() (data []interface{}, hadEnd bool)
type StackTrace ¶ added in v1.2.6
type StackTraces ¶ added in v1.2.6
type StackTraces struct { ThreadID int StackTraces []StackTrace }
type SymbolTable ¶
type SymbolTable struct { Verbose string InitedId map[int]struct{} // contains filtered or unexported fields }
func NewSymbolTable ¶
func NewSymbolTable() *SymbolTable
func (*SymbolTable) CreateSubSymbolTable ¶
func (s *SymbolTable) CreateSubSymbolTable(verbose ...string) *SymbolTable
func (*SymbolTable) GetLocalSymbolByVariableName ¶
func (s *SymbolTable) GetLocalSymbolByVariableName(name string) (int, bool)
func (*SymbolTable) GetNameByVariableId ¶
func (s *SymbolTable) GetNameByVariableId(id int) (string, bool)
func (*SymbolTable) GetParentSymbolTable ¶
func (s *SymbolTable) GetParentSymbolTable() *SymbolTable
func (*SymbolTable) GetRoot ¶
func (s *SymbolTable) GetRoot() (*SymbolTable, error)
func (*SymbolTable) GetSymbolByVariableName ¶
func (s *SymbolTable) GetSymbolByVariableName(name string) (int, bool)
func (*SymbolTable) GetSymbolTableById ¶
func (s *SymbolTable) GetSymbolTableById(id int) *SymbolTable
func (*SymbolTable) GetTableCount ¶
func (s *SymbolTable) GetTableCount() int
func (*SymbolTable) GetTableIndex ¶
func (s *SymbolTable) GetTableIndex() int
func (*SymbolTable) IdIsInited ¶
func (s *SymbolTable) IdIsInited(id int) bool
func (*SymbolTable) IsNew ¶
func (s *SymbolTable) IsNew() bool
func (*SymbolTable) MustRoot ¶
func (s *SymbolTable) MustRoot() *SymbolTable
func (*SymbolTable) NewSymbolWithReturn ¶
func (s *SymbolTable) NewSymbolWithReturn(name string) (int, error)
func (*SymbolTable) NewSymbolWithoutName ¶
func (s *SymbolTable) NewSymbolWithoutName() int
func (*SymbolTable) SetIdIsInited ¶
func (s *SymbolTable) SetIdIsInited(id int)
type SymbolTableDesc ¶
type VMPanic ¶
type VMPanic struct {
// contains filtered or unexported fields
}
func NewVMPanic ¶
func NewVMPanic(i interface{}) *VMPanic
func (*VMPanic) GetDataDescription ¶ added in v1.2.6
type VMPanicSignal ¶
type VMPanicSignal struct { Info interface{} AdditionalInfo interface{} }
type Value ¶
type Value struct { TypeVerbose string Value interface{} Literal string // Identifier = expr // 当变量被赋值时,SymbolId 应该为赋值操作的根本 SymbolId int // MemberCall 和 SliceCall 的 Caller 和 Collee // 一般来说 Caller.Callee 的时候,Callee 应该取 Identifier 的 Value 值 // Caller[Callee] 的时候,Callee 取 Value // 这几个操作用反射都可以很容易做到 CallerRef *Value CalleeRef *Value ExtraInfo map[string]interface{} }
func ChannelValueListToValue ¶
func GetNaslValueBySymbolId ¶
func GetUndefined ¶
func GetUndefined() *Value
func NewAutoValue ¶
func NewAutoValue(b interface{}) *Value
func NewBoolValue ¶
func NewEmptyMap ¶
func NewEmptyOMap ¶ added in v1.3.3
func NewGeneralMap ¶
func NewGenericMap ¶
func NewIdentifierValue ¶
func NewInt64Value ¶
func NewIntValue ¶
func NewStringSliceValue ¶
func NewStringValue ¶
func NewUndefined ¶
func NewValueRef ¶
func (*Value) AddExtraInfo ¶
func (*Value) AssignBySymbol ¶
func (*Value) CallSliceIndex ¶
func (*Value) ConvertToLeftValue ¶
ConvertToLeftValue 当前值能不能转成左值? 这个是方法调用赋值的关键
func (*Value) GetExtraInfo ¶
func (*Value) GetIndexedVariableCount ¶ added in v1.2.6
func (*Value) GetLeftCallerNIndex ¶
func (*Value) GetNamedVariableCount ¶ added in v1.2.6
func (*Value) GetNativeCallFunctionName ¶
func (*Value) GlobalAssign ¶
func (*Value) GlobalAssignBySymbol ¶
func (*Value) IsBytesOrRunes ¶ added in v1.2.6
func (*Value) IsChannelValueList ¶
func (*Value) IsIdentifier ¶
func (*Value) IsIterable ¶
func (*Value) IsLeftMemberCall ¶
func (*Value) IsLeftSliceCall ¶
func (*Value) IsLeftValueRef ¶
func (*Value) IsStringOrBytes ¶
func (*Value) IsUndefined ¶
func (*Value) IsValueList ¶
func (*Value) IsYakFunction ¶
func (*Value) LeftMemberAssignTo ¶
func (*Value) LeftSliceAssignTo ¶
func (*Value) LuaFunctionNCall ¶
func (*Value) LuaLeftSliceAssignTo ¶
func (*Value) NativeAsyncCall ¶
func (*Value) NativeCall ¶
func (*Value) NativeCallable ¶
func (*Value) ValueListToInterface ¶
func (v *Value) ValueListToInterface() interface{}
func (*Value) YakFunctionNAsyncCall ¶
func (*Value) YakFunctionNCall ¶
type VirtualMachine ¶
type VirtualMachine struct { VMStack *vmstack.Stack BreakPoint []BreakPointFactoryFun ThreadIDCount uint64 GetExternalVar func(name string) (any, bool) // contains filtered or unexported fields }
func New ¶
func New() *VirtualMachine
func NewWithSymbolTable ¶
func NewWithSymbolTable(table *SymbolTable) *VirtualMachine
func (*VirtualMachine) AddBreakPoint ¶
func (v *VirtualMachine) AddBreakPoint(fun BreakPointFactoryFun)
func (*VirtualMachine) AsyncEnd ¶ added in v1.2.9
func (v *VirtualMachine) AsyncEnd()
func (*VirtualMachine) AsyncStart ¶ added in v1.2.9
func (v *VirtualMachine) AsyncStart()
func (*VirtualMachine) AsyncWait ¶ added in v1.2.9
func (v *VirtualMachine) AsyncWait()
func (*VirtualMachine) CurrentFM ¶
func (v *VirtualMachine) CurrentFM() *Frame
func (*VirtualMachine) ExecAsyncYakFunction ¶
func (*VirtualMachine) ExecYakCode ¶
func (*VirtualMachine) ExecYakFunction ¶
func (*VirtualMachine) GetConfig ¶
func (v *VirtualMachine) GetConfig() *VirtualMachineConfig
func (*VirtualMachine) GetDebugger ¶ added in v1.2.6
func (n *VirtualMachine) GetDebugger() *Debugger
func (*VirtualMachine) GetExternalVariableNames ¶
func (n *VirtualMachine) GetExternalVariableNames() []string
func (*VirtualMachine) GetGlobalVar ¶
func (n *VirtualMachine) GetGlobalVar() *limitedmap.ReadOnlyMap
func (*VirtualMachine) GetNaslGlobalVarTable ¶
func (n *VirtualMachine) GetNaslGlobalVarTable() (map[int]*Value, error)
func (*VirtualMachine) GetRuntimeGlobalVar ¶
func (n *VirtualMachine) GetRuntimeGlobalVar() *limitedmap.SafeMap
func (*VirtualMachine) GetVar ¶
func (n *VirtualMachine) GetVar(name string) (interface{}, bool)
func (*VirtualMachine) GetVarWithoutFrame ¶
func (n *VirtualMachine) GetVarWithoutFrame(name string) (any, bool)
func (*VirtualMachine) ImportLibs ¶
func (n *VirtualMachine) ImportLibs(libs map[string]interface{})
ImportLibs 导入库到引擎的全局变量中
func (*VirtualMachine) InlineExecYakCode ¶
func (*VirtualMachine) RegisterGlobalVariableFallback ¶
func (n *VirtualMachine) RegisterGlobalVariableFallback(h func(string) interface{})
func (*VirtualMachine) RegisterMapMemberCallHandler ¶
func (n *VirtualMachine) RegisterMapMemberCallHandler(caller, callee string, h func(interface{}) interface{})
func (*VirtualMachine) SetConfig ¶
func (v *VirtualMachine) SetConfig(config *VirtualMachineConfig)
func (*VirtualMachine) SetDebug ¶
func (v *VirtualMachine) SetDebug(debug bool)
func (*VirtualMachine) SetDebugMode ¶
func (v *VirtualMachine) SetDebugMode(debug bool, sourceCode string, codes []*Code, debugInit, debugCallback func(*Debugger))
func (*VirtualMachine) SetSandboxMode ¶ added in v1.3.1
func (v *VirtualMachine) SetSandboxMode(mode bool)
func (*VirtualMachine) SetSymboltable ¶
func (v *VirtualMachine) SetSymboltable(table *SymbolTable)
func (*VirtualMachine) SetVars ¶
func (n *VirtualMachine) SetVars(m map[string]any)
SetVars 导入变量到引擎的全局变量中
type VirtualMachineConfig ¶
type VirtualMachineConfig struct {
// contains filtered or unexported fields
}
func NewVMConfig ¶
func NewVMConfig() *VirtualMachineConfig
func (*VirtualMachineConfig) GetClosureSupport ¶
func (c *VirtualMachineConfig) GetClosureSupport() bool
func (*VirtualMachineConfig) GetFunctionNumberCheck ¶
func (c *VirtualMachineConfig) GetFunctionNumberCheck() bool
func (*VirtualMachineConfig) GetStopRecover ¶
func (c *VirtualMachineConfig) GetStopRecover() bool
func (*VirtualMachineConfig) SetClosureSupport ¶
func (c *VirtualMachineConfig) SetClosureSupport(b bool)
func (*VirtualMachineConfig) SetFunctionNumberCheck ¶
func (c *VirtualMachineConfig) SetFunctionNumberCheck(b bool)
func (*VirtualMachineConfig) SetStopRecover ¶
func (c *VirtualMachineConfig) SetStopRecover(b bool)
func (*VirtualMachineConfig) SetYVMMode ¶
func (c *VirtualMachineConfig) SetYVMMode(mode YVMMode)
type YakitFeedbacker ¶
type YakitFeedbacker interface{}
Source Files ¶
- base.go
- buildin.go
- buildin_method.go
- buildin_method_array.go
- buildin_method_bytes.go
- buildin_method_map.go
- buildin_method_string.go
- catch_error.go
- compiler_wrapper.go
- config.go
- debugger.go
- debugger_breakpoint.go
- debugger_ref.go
- func.go
- iterator.go
- op_assign.go
- op_binary.go
- op_call.go
- op_unary.go
- opcodes_marshal.go
- runtime.go
- scope.go
- stack.go
- symboltable.go
- utils.go
- value.go
- value_call.go
- value_types.go
- virtual_machine.go
- vm.go
- vm_defer.go
- vm_exec.go
- vm_hijack.go
- vm_panic.go
- vm_scope.go
Click to show internal directories.
Click to hide internal directories.