Improved error handling

This commit is contained in:
Eduard Urbach 2024-06-15 18:42:31 +02:00
parent 78cde0d0bd
commit a48f2868fb
Signed by: eduard
GPG key ID: 49226B848C78F6C8
7 changed files with 71 additions and 60 deletions

View file

@ -11,6 +11,11 @@ type Token struct {
Bytes []byte
}
// After returns the position after the token.
func (t Token) After() int {
return t.Position + len(t.Bytes)
}
// String creates a human readable representation for debugging purposes.
func (t Token) String() string {
return fmt.Sprintf("%s %s", t.Kind, t.Text())