mirror of
https://github.com/astaxie/beego.git
synced 2024-12-23 19:40:50 +00:00
37 lines
574 B
Go
37 lines
574 B
Go
package govaluate
|
|
|
|
type tokenStream struct {
|
|
tokens []ExpressionToken
|
|
index int
|
|
tokenLength int
|
|
}
|
|
|
|
func newTokenStream(tokens []ExpressionToken) *tokenStream {
|
|
|
|
var ret *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 {
|
|
|
|
var token ExpressionToken
|
|
|
|
token = this.tokens[this.index]
|
|
|
|
this.index += 1
|
|
return token
|
|
}
|
|
|
|
func (this tokenStream) hasNext() bool {
|
|
|
|
return this.index < this.tokenLength
|
|
}
|