stack

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 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 Frame

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

func NewBlockScopeFrame

func NewBlockScopeFrame(scope symbol.Scope) *Frame

func NewObjectStackFrame

func NewObjectStackFrame(object *FuncObject) *Frame

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) GetValue

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

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
}

func NewEmptyObject

func NewEmptyObject() Object

func NewVariableObject

func NewVariableObject() Object

type Stack

type Stack []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