stack

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2022 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClassObject added in v0.0.6

type ClassObject struct {
	// contains filtered or unexported fields
}

func NewClassObject added in v0.0.6

func NewClassObject(class *symbol.Class) *ClassObject

func (*ClassObject) AllField added in v0.0.6

func (c *ClassObject) AllField() map[*symbol.Variable]interface{}

func (*ClassObject) GetObject added in v0.0.8

func (c *ClassObject) GetObject() Object

func (ClassObject) GetValue added in v0.0.6

func (o ClassObject) GetValue(variable *symbol.Variable) interface{}

func (*ClassObject) SetValue added in v0.0.6

func (c *ClassObject) SetValue(variable *symbol.Variable, value interface{})

func (ClassObject) String added in v0.0.6

func (o ClassObject) String() string

type Frame

type Frame struct {
	// contains filtered or unexported fields
}

func NewBlockScopeFrame

func NewBlockScopeFrame(scope symbol.Scope) *Frame

func NewClassStackFrame added in v0.0.6

func NewClassStackFrame(classObject *ClassObject) *Frame

func NewObjectStackFrame

func NewObjectStackFrame(object *FuncObject) *Frame

func (*Frame) ContainsVariable added in v0.0.6

func (s *Frame) ContainsVariable(variable *symbol.Variable) bool

ContainsVariable 当前栈帧中是否包含某个变量的数据

func (*Frame) GetObject

func (s *Frame) GetObject() Object

func (*Frame) GetParent

func (s *Frame) GetParent() *Frame

func (*Frame) GetScope

func (s *Frame) GetScope() symbol.Scope

func (*Frame) SetParent

func (s *Frame) SetParent(f *Frame)

func (*Frame) String

func (s *Frame) String() string

type FuncObject

type FuncObject struct {
	// contains filtered or unexported fields
}

func NewFuncObject

func NewFuncObject(function *symbol.Func) *FuncObject

func (*FuncObject) GetFunction

func (f *FuncObject) GetFunction() *symbol.Func

func (*FuncObject) GetReferenceVariable added in v0.0.6

func (f *FuncObject) GetReferenceVariable() *symbol.Variable

func (FuncObject) GetValue

func (o FuncObject) GetValue(variable *symbol.Variable) interface{}

func (*FuncObject) SetReferenceVariable added in v0.0.6

func (f *FuncObject) SetReferenceVariable(variable *symbol.Variable)

func (*FuncObject) SetValue

func (f *FuncObject) SetValue(variable *symbol.Variable, value interface{})

func (FuncObject) String

func (o FuncObject) String() string

type Object

type Object interface {
	GetValue(variable *symbol.Variable) interface{}
	SetValue(variable *symbol.Variable, value interface{})
	String() string
}

Object 变量对象,可以获取和保存变量的值

func NewEmptyObject

func NewEmptyObject() Object

func NewVariableObject

func NewVariableObject() Object

type Stack

type Stack []interface{}

func (*Stack) Get added in v0.0.6

func (s *Stack) Get(i int) interface{}

func (*Stack) IsEmpty

func (s *Stack) IsEmpty() bool

IsEmpty check if Stack is empty

func (*Stack) Peek

func (s *Stack) Peek() interface{}

Peek Peek value, not remove element.

func (*Stack) Pop

func (s *Stack) Pop() interface{}

Pop Remove and return top element of Stack. Return false if Stack is empty.

func (*Stack) Push

func (s *Stack) Push(val interface{})

Push a new value onto the Stack

func (*Stack) Size

func (s *Stack) Size() int

Jump to

Keyboard shortcuts

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