Files
dependabot[bot] 8d6385e2eb Bump github.com/xo/terminfo from 1.0.0 to 1.2.0
Bumps [github.com/xo/terminfo](https://github.com/xo/terminfo) from 1.0.0 to 1.2.0.
- [Release notes](https://github.com/xo/terminfo/releases)
- [Commits](https://github.com/xo/terminfo/compare/v1.0.0...v1.2.0)

---
updated-dependencies:
- dependency-name: github.com/xo/terminfo
  dependency-version: 1.2.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-10-16 05:33:53 +00:00

49 lines
637 B
Go

package terminfo
type stack []any
func (s *stack) push(v any) {
*s = append(*s, v)
}
func (s *stack) pop() any {
if len(*s) == 0 {
return nil
}
v := (*s)[len(*s)-1]
*s = (*s)[:len(*s)-1]
return v
}
func (s *stack) popInt() int {
if i, ok := s.pop().(int); ok {
return i
}
return 0
}
func (s *stack) popBool() bool {
if b, ok := s.pop().(bool); ok {
return b
}
return false
}
func (s *stack) popByte() byte {
if b, ok := s.pop().(byte); ok {
return b
}
return 0
}
func (s *stack) popString() string {
if a, ok := s.pop().(string); ok {
return a
}
return ""
}
func (s *stack) reset() {
*s = (*s)[:0]
}