expressions now support intger value in bin (0b), oct (0o), and hex (0x) form

This commit is contained in:
2024-04-17 14:15:50 +02:00
parent b6887af77a
commit 54bc759f70
3 changed files with 105 additions and 33 deletions
+14
View File
@@ -67,3 +67,17 @@ func (self *Token) Errorf(template string, args ...any) (err error) {
err = fmt.Errorf(fmt.Sprintf("[%d:%d] ", self.row, self.col)+template, args...)
return
}
func (self *Token) Error() (err error) {
if self.Sym == SymError {
if msg, ok := self.Value.(error); ok {
err = fmt.Errorf("[%d:%d] %v", self.row, self.col, msg)
}
}
return
}
func (self *Token) Errors(msg string) (err error) {
err = fmt.Errorf("[%d:%d] %v", self.row, self.col, msg)
return
}