MCPcopy Create free account
hub / github.com/SeldonIO/goven / Pop

Method Pop

parser/stack.go:18–26  ·  view source on GitHub ↗

Pop removes and returns a token from the TokenStack.

()

Source from the content-addressed store, hash-verified

16
17// Pop removes and returns a token from the TokenStack.
18func (s *TokenStack) Pop() (TokenInfo, error) {
19 if len(s.stack) == 0 {
20 return TokenInfo{}, errors.New("stack is empty")
21 }
22 l := len(s.stack)
23 token := s.stack[l-1]
24 s.stack = s.stack[:l-1]
25 return token, nil
26}
27
28// Len returns the current length of the TokenStack.
29func (s *TokenStack) Len() int {

Callers 2

TestTokenStackFunction · 0.95
scanMethod · 0.80

Calls

no outgoing calls

Tested by 1

TestTokenStackFunction · 0.76