MCPcopy Create free account
hub / github.com/egonelbre/exp / tryPop

Method tryPop

ber/decoder.go:57–74  ·  view source on GitHub ↗
(at int)

Source from the content-addressed store, hash-verified

55}
56
57func (s *stack) tryPop(at int) (bool, *Token, error) {
58 // no open types
59 if len(s.open) == 0 {
60 return false, nil, nil
61 }
62 last := len(s.closeat) - 1
63 next := s.closeat[last]
64 switch {
65 case next == 0: // indefinite
66 return false, nil, nil
67 case next == at:
68 t, err := s.pop()
69 return true, t, err
70 case next > at:
71 return false, nil, SyntaxError{"read past end of previous type"}
72 }
73 return false, nil, nil
74}
75
76func NewDecoder(r io.Reader) *Decoder {
77 return &Decoder{

Callers 1

TokenMethod · 0.45

Calls 1

popMethod · 0.95

Tested by

no test coverage detected