Shift returns the first element and advances position.
()
| 75 | |
| 76 | // Shift returns the first element and advances position. |
| 77 | func (z *TokenBuffer) Shift() *Token { |
| 78 | if z.pos >= len(z.buf) { |
| 79 | t := &z.buf[:1][0] |
| 80 | z.read(t) |
| 81 | return t |
| 82 | } |
| 83 | t := &z.buf[z.pos] |
| 84 | z.pos++ |
| 85 | return t |
| 86 | } |