This code panics on the marked line. It seems like IsValid() incorrectly returns true when it should return false since there are no more tokens available.
p := tokenizer.New()
stream := p.ParseString("")
defer stream.Close()
for stream.IsValid() {
token := stream.CurrentToken()
if token.Is(tokenizer.TokenInteger) { // <--- panic
fmt.Println(token.ValueInt())
}
stream.GoNext()
}
I'm using 1.3.0 and the panic stack trace tells me the problem is here:
This code panics on the marked line. It seems like
IsValid()
incorrectly returns true when it should return false since there are no more tokens available.I'm using 1.3.0 and the panic stack trace tells me the problem is here: