summaryrefslogtreecommitdiffhomepage
path: root/mintages/errors.go
blob: 73194040e6c5cc0ded09de9f33fdd7499dfec276 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package mintages

import "fmt"

type location struct {
	file   string
	linenr int
}

func (loc location) String() string {
	return fmt.Sprintf("%s: %d", loc.file, loc.linenr)
}

type SyntaxError struct {
	location
	expected, got string
}

func (e SyntaxError) Error() string {
	return fmt.Sprintf("%s: syntax error: expected %s but got %s",
		e.location, e.expected, e.got)
}