aboutsummaryrefslogtreecommitdiff
path: root/parser/errors.go
diff options
context:
space:
mode:
Diffstat (limited to 'parser/errors.go')
-rw-r--r--parser/errors.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/parser/errors.go b/parser/errors.go
new file mode 100644
index 0000000..f6369be
--- /dev/null
+++ b/parser/errors.go
@@ -0,0 +1,19 @@
+package parser
+
+import "fmt"
+
+type invalidSyntax struct {
+ pos position
+ expected string
+ found string
+}
+
+func (e invalidSyntax) Error() string {
+ return fmt.Sprintf("Syntax error near %v; expected %s but found %s", e.pos, e.expected, e.found)
+}
+
+type eof struct{}
+
+func (e eof) Error() string {
+ return "Hit end-of-file while parsing. You’re probably missing a closing brace (‘}’) somewhere"
+}