diff options
| author | _ov4 <ov4@ov4.org> | 2026-09-09 12:28:04 +0000 |
|---|---|---|
| committer | _ov4 <ov4@ov4.org> | 2026-09-09 12:28:04 +0000 |
| commit | ffcf768d07c82a2213674fbec623c684e8feb9ee (patch) | |
| tree | ba5a0182fa72aeed61073f7c7063ab268ecdd6c0 /include | |
| parent | 88a3cd56846200c883816a2a394c8ae5e466fe21 (diff) | |
add error system
Diffstat (limited to 'include')
| -rw-r--r-- | include/error.h | 29 |
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) {} +}; + +} |
