scan returns the next token from the underlying scanner or the last scanned token if an unscan was requested
()
| 119 | // scan returns the next token from the underlying scanner |
| 120 | // or the last scanned token if an unscan was requested |
| 121 | func (p *Parser) scan() (token, string, error) { |
| 122 | if p.unreadLastChar { |
| 123 | p.unreadLastChar = false |
| 124 | return p.currentParsedChar.tok, p.currentParsedChar.lit, nil |
| 125 | } |
| 126 | |
| 127 | tok, lit, err := p.s.scan() |
| 128 | |
| 129 | p.currentParsedChar.tok, p.currentParsedChar.lit = tok, lit |
| 130 | |
| 131 | return tok, lit, err |
| 132 | } |
| 133 | |
| 134 | // unscan pushes the previously read token back onto the buffer. |
| 135 | func (p *Parser) unscan() { p.unreadLastChar = true } |
no outgoing calls