Token.Is and Token.ValueIs work properly
This commit is contained in:
parent
28fa7321df
commit
d693132513
|
@ -97,16 +97,16 @@ func (tok Token) EOF () bool {
|
|||
|
||||
func (tok Token) Is (kinds ...TokenKind) bool {
|
||||
for _, kind := range kinds {
|
||||
if tok.Kind != kind { return false }
|
||||
if tok.Kind == kind { return true }
|
||||
}
|
||||
return true
|
||||
return false
|
||||
}
|
||||
|
||||
func (tok Token) ValueIs (values ...string) bool {
|
||||
for _, value := range values {
|
||||
if tok.Value != value { return false }
|
||||
if tok.Value == value { return true }
|
||||
}
|
||||
return true
|
||||
return false
|
||||
}
|
||||
|
||||
type Lexer interface {
|
||||
|
|
Loading…
Reference in New Issue