aboutsummaryrefslogtreecommitdiff
path: root/parser/errors.go
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2023-09-02 18:49:53 +0200
committerThomas Voss <mail@thomasvoss.com> 2023-09-08 23:16:19 +0200
commit643623dbecdc1ccb6f3ac77e4ebabdc6ca1d8d06 (patch)
treea9d6b50ad7263e792bc276f765ada74a5661a8b1 /parser/errors.go
Genesis commit
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"
+}