Pop removes the top element from the stack and returns its value If the stack is empty, return nil
()
| 26 | // Pop removes the top element from the stack and returns its value |
| 27 | // If the stack is empty, return nil |
| 28 | func (s *TEStack) Pop() (value *TextEvent) { |
| 29 | if s.Size > 0 { |
| 30 | value, s.Top = s.Top.Value, s.Top.Next |
| 31 | s.Size-- |
| 32 | return |
| 33 | } |
| 34 | return nil |
| 35 | } |
| 36 | |
| 37 | // Peek returns the top element of the stack without removing it |
| 38 | func (s *TEStack) Peek() *TextEvent { |
no outgoing calls