aboutsummaryrefslogtreecommitdiff
path: root/include/error.h
blob: d8be4e5131b283e0e2c93268ab8b1c15ac2e286b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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) {}
};
    
}