aboutsummaryrefslogtreecommitdiff
path: root/include/error.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/error.h')
-rw-r--r--include/error.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/include/error.h b/include/error.h
new file mode 100644
index 0000000..d8be4e5
--- /dev/null
+++ b/include/error.h
@@ -0,0 +1,29 @@
+#pragma once
+
+#include <stdexcept>
+
+namespace ov4
+{
+
+enum class error_code
+{
+
+ // tokenizer
+ TOKEN_UNMATCHED_BRACKET,
+
+ // AST
+ AST_MISS_LEFT_CHILD,
+ AST_MISS_RIGHT_CHILD,
+ AST_EXIST_LEFT_CHILLD,
+ AST_EXIST_RIGHT_CHILD,
+
+};
+
+class T_error : public std::runtime_error {
+public:
+ error_code code;
+ T_error(error_code k, std::string msg)
+ : std::runtime_error(std::move(msg)), code(k) {}
+};
+
+}