21 lines
390 B
C++
21 lines
390 B
C++
#include "error.h"
|
|
#include <stdio.h>
|
|
#include "tokenizer.h"
|
|
|
|
static char errormsg[255];
|
|
static bool raised = false;
|
|
|
|
|
|
void error_raise(const char* msg) {
|
|
if (!raised) {
|
|
raised = true;
|
|
sprintf(errormsg, "ERROR: %s at %d:%d.", msg, tkn_get_line() + 1, tkn_get_row() + 1);
|
|
}
|
|
}
|
|
|
|
bool error_raised() { return raised; }
|
|
|
|
void error_print() {
|
|
printf("%s", errormsg);
|
|
}
|