Documentation
¶
Index ¶
- type Frame
- type Stack
- func (s *Stack) BufferSize() int
- func (s *Stack) Cur() int
- func (s *Stack) Extend(extendBy int)
- func (s *Stack) Get(i int) (interface{}, error)
- func (s *Stack) Grow(min int)
- func (s *Stack) Pop() interface{}
- func (s *Stack) Push(v interface{})
- func (s *Stack) Reset()
- func (s *Stack) Resize(size int)
- func (s *Stack) Set(i int, v interface{})
- func (s *Stack) SetCur(c int)
- func (s *Stack) Size() int
- func (s *Stack) String() string
- func (s *Stack) Top() (interface{}, error)
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
}
Frame represents a single stack frame. It has a reference to the main stack where the actual data resides. Frame is just a convenient wrapper to remember when the Frame started
func (*Frame) DeclareVar ¶
DeclareVar puts a new variable in the stack, and returns the index where it now resides
func (*Frame) LastLvarIndex ¶
LastLvarIndex returns the index of the last element in our stack.
type Stack ¶
type Stack struct {
// contains filtered or unexported fields
}
Stack is a simple structure to hold various data
func (*Stack) BufferSize ¶
BufferSize returns the length of the underlying buffer
func (*Stack) Cur ¶
Cur returns the current stack index. Note that if nothing is stored in the stack, it returns -1
func (*Stack) Grow ¶
Grow automatically grows the underlying buffer so that it can hold at least `min` elements
func (*Stack) Pop ¶
func (s *Stack) Pop() interface{}
Pop removes and returns the item at the end of the stack
func (*Stack) Push ¶
func (s *Stack) Push(v interface{})
Push adds an element at the end of the stack
func (*Stack) Reset ¶
func (s *Stack) Reset()
Reset clears the contents of the stack and pushes back the cursor as if nothing is in the stack
func (*Stack) Set ¶
Set sets the element at position `i` to `v`. The stack size is automatically adjusted.