From ffcf768d07c82a2213674fbec623c684e8feb9ee Mon Sep 17 00:00:00 2001 From: _ov4 Date: Wed, 9 Sep 2026 12:28:04 +0000 Subject: add error system --- include/error.h | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 include/error.h (limited to 'include/error.h') 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 + +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) {} +}; + +} -- cgit v1.3.1-4-g156e