about summary refs log tree commit diff
path: root/users/tazjin/rlox/src/errors.rs
diff options
context:
space:
mode:
Diffstat (limited to 'users/tazjin/rlox/src/errors.rs')
-rw-r--r--users/tazjin/rlox/src/errors.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/users/tazjin/rlox/src/errors.rs b/users/tazjin/rlox/src/errors.rs
new file mode 100644
index 000000000000..46c739ef2f46
--- /dev/null
+++ b/users/tazjin/rlox/src/errors.rs
@@ -0,0 +1,14 @@
+#[derive(Debug)]
+pub enum ErrorKind {
+    UnexpectedChar(char),
+}
+
+#[derive(Debug)]
+pub struct Error {
+    pub line: usize,
+    pub kind: ErrorKind,
+}
+
+pub fn report(loc: &str, err: &Error) {
+    eprintln!("[line {}] Error {}: {:?}", err.line, loc, err.kind);
+}