token.go: function IsSymbol()

This commit is contained in:
Celestino Amoroso 2024-05-04 19:08:02 +02:00
parent a2c0a24494
commit f9ed5776cd

View File

@ -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