aboutsummaryrefslogtreecommitdiff
path: root/exc.cpp
blob: 648326e201e99420cc7f0b9d1cd5cad81b314759 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include "exc.h"
#include <cstdio>

SyntaxError::SyntaxError(ErrCode _code) : code(_code) {}

string SyntaxError::get_msg() { return this->msg; }

TokenError::TokenError(string token, ErrCode code) : SyntaxError(code) {
    static char buffer[1024];   // should be enough
    sprintf(buffer, SYN_ERR_MSG[code], token.c_str());
    msg = buffer;
}

NormalError::NormalError(ErrCode code) : SyntaxError(code) {
    msg = SYN_ERR_MSG[code];
}