token.go: function IsSymbol()
This commit is contained in:
parent
a2c0a24494
commit
f9ed5776cd
4
token.go
4
token.go
@ -63,6 +63,10 @@ func (tk *Token) IsTerm(termSymbols []Symbol) bool {
|
||||
return tk.IsEos() || tk.IsError() || (termSymbols != nil && slices.Index(termSymbols, tk.Sym) >= 0)
|
||||
}
|
||||
|
||||
func (tk *Token) IsSymbol(sym Symbol) bool {
|
||||
return tk.Sym == sym
|
||||
}
|
||||
|
||||
func (self *Token) Errorf(template string, args ...any) (err error) {
|
||||
err = fmt.Errorf(fmt.Sprintf("[%d:%d] ", self.row, self.col)+template, args...)
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user