Let
This commit is contained in:
parent
7c40723537
commit
8f5b16878f
4 changed files with 316 additions and 144 deletions
7
input.go
7
input.go
|
|
@ -28,10 +28,13 @@ func (in *Input) Peek(i int) Lexeme {
|
|||
return in.input[in.index+i]
|
||||
}
|
||||
|
||||
func (in *Input) Pop() Lexeme {
|
||||
func (in *Input) Pop() (Lexeme, bool) {
|
||||
if in.index > len(in.input)-1 {
|
||||
return nil, false
|
||||
}
|
||||
v := in.input[in.index]
|
||||
in.index++
|
||||
return v
|
||||
return v, true
|
||||
}
|
||||
|
||||
func (in *Input) Seek(i int) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue