mirror of
https://codeberg.org/scip/tablizer.git
synced 2025-12-18 13:01:11 +01:00
22 lines
420 B
Go
22 lines
420 B
Go
package zygo
|
|
|
|
type Address struct {
|
|
function *SexpFunction
|
|
position int
|
|
}
|
|
|
|
func (a Address) IsStackElem() {}
|
|
|
|
func (stack *Stack) PushAddr(function *SexpFunction, pc int) {
|
|
stack.Push(Address{function, pc})
|
|
}
|
|
|
|
func (stack *Stack) PopAddr() (*SexpFunction, int, error) {
|
|
elem, err := stack.Pop()
|
|
if err != nil {
|
|
return MissingFunction, 0, err
|
|
}
|
|
addr := elem.(Address)
|
|
return addr.function, addr.position, nil
|
|
}
|