Files
eval/tokenStream.go
zeekay 011df15db5 eval: expression evaluator forked from casbin/govaluate v1.3.0
Module path renamed to github.com/hanzoai/eval and the Go package
renamed from govaluate to eval. Evaluation, parsing, lexing, and
operator behavior are unchanged; MIT license and George Lester
attribution retained. See NOTICE for lineage.
2026-07-18 00:27:32 -07:00

31 lines
518 B
Go

package eval
type tokenStream struct {
tokens []ExpressionToken
index int
tokenLength int
}
func newTokenStream(tokens []ExpressionToken) *tokenStream {
ret := new(tokenStream)
ret.tokens = tokens
ret.tokenLength = len(tokens)
return ret
}
func (this *tokenStream) rewind() {
this.index -= 1
}
func (this *tokenStream) next() ExpressionToken {
token := this.tokens[this.index]
this.index += 1
return token
}
func (this tokenStream) hasNext() bool {
return this.index < this.tokenLength
}