Shift returns the first element and advances position.
()
| 99 | |
| 100 | // Shift returns the first element and advances position. |
| 101 | func (z *TokenBuffer) Shift() *Token { |
| 102 | if z.pos >= len(z.buf) { |
| 103 | t := &z.buf[:1][0] |
| 104 | z.read(t) |
| 105 | return t |
| 106 | } |
| 107 | t := &z.buf[z.pos] |
| 108 | z.pos++ |
| 109 | return t |
| 110 | } |
| 111 | |
| 112 | // Attributes extracts the gives attribute hashes from a tag. |
| 113 | // It returns in the same order pointers to the requested token data or nil. |