6c4344623b
The main HCL package is more visible this way, and so it's easier than having to pick it out from dozens of other package directories.
26 lines
330 B
Go
26 lines
330 B
Go
package json
|
|
|
|
type peeker struct {
|
|
tokens []token
|
|
pos int
|
|
}
|
|
|
|
func newPeeker(tokens []token) *peeker {
|
|
return &peeker{
|
|
tokens: tokens,
|
|
pos: 0,
|
|
}
|
|
}
|
|
|
|
func (p *peeker) Peek() token {
|
|
return p.tokens[p.pos]
|
|
}
|
|
|
|
func (p *peeker) Read() token {
|
|
ret := p.tokens[p.pos]
|
|
if ret.Type != tokenEOF {
|
|
p.pos++
|
|
}
|
|
return ret
|
|
}
|