This commit is contained in:
silva guimaraes 2025-05-25 21:56:22 -03:00
parent 7c40723537
commit 8f5b16878f
4 changed files with 316 additions and 144 deletions

View file

@ -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) {