about summary refs log tree commit diff
path: root/pkg/lang/compiler/errors.go
diff options
context:
space:
mode:
authorMel <einebeere@gmail.com>2022-08-18 19:49:01 +0000
committerMel <einebeere@gmail.com>2022-08-18 19:49:01 +0000
commit73ac132294f3e659f1d769c961aa45bafdd19b45 (patch)
tree927ccf9f89209c2884ceef366322301a9b0065cf /pkg/lang/compiler/errors.go
parent0b06db39b833099bc6683abff176b13a1c97ca93 (diff)
downloadjinx-73ac132294f3e659f1d769c961aa45bafdd19b45.tar.zst
jinx-73ac132294f3e659f1d769c961aa45bafdd19b45.zip
Ad-hoc error location for compiler errors
Diffstat (limited to 'pkg/lang/compiler/errors.go')
-rw-r--r--pkg/lang/compiler/errors.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/pkg/lang/compiler/errors.go b/pkg/lang/compiler/errors.go
new file mode 100644
index 0000000..45f14cc
--- /dev/null
+++ b/pkg/lang/compiler/errors.go
@@ -0,0 +1,16 @@
+package compiler
+
+import (
+	"fmt"
+	"jinx/pkg/libs/source"
+)
+
+type Error struct {
+	Module string
+	Loc    source.Loc
+	Err    error
+}
+
+func (e Error) Error() string {
+	return fmt.Sprintf("compiler error at %s:%d:%d: %v", e.Module, e.Loc.Row, e.Loc.Col, e.Err)
+}