diff options
Diffstat (limited to 'src/bootstrap/errors.c')
-rw-r--r-- | src/bootstrap/errors.c | 31 |
1 files changed, 1 insertions, 30 deletions
diff --git a/src/bootstrap/errors.c b/src/bootstrap/errors.c index c1d2879..d957cfa 100644 --- a/src/bootstrap/errors.c +++ b/src/bootstrap/errors.c | |||
@@ -1,32 +1,4 @@ | |||
1 | typedef enum ErrorType { | 1 | #include "errors.h" |
2 | ERR_TYPE_LEXER, | ||
3 | ERR_TYPE_PARSER, | ||
4 | ERR_TYPE_RUNTIME, | ||
5 | } ErrorType; | ||
6 | |||
7 | typedef enum ErrorValue { | ||
8 | ERR_UNKNOWN = 0, | ||
9 | ERR_UNMATCHED_STRING, | ||
10 | ERR_UNBALANCED_PAREN, | ||
11 | ERR_NOT_IMPLEMENTED, | ||
12 | ERR_EOF_REACHED, | ||
13 | ERR_UNKNOWN_TOKEN, | ||
14 | ERR_UNKNOWN_OBJ_TYPE, | ||
15 | ERR_NOT_A_SYMBOL, | ||
16 | ERR_SYMBOL_NOT_FOUND, | ||
17 | ERR_OBJ_NOT_CALLABLE, | ||
18 | ERR_NOT_ENOUGH_ARGS, | ||
19 | ERR_TOO_MANY_ARGS, | ||
20 | ERR_WRONG_ARG_TYPE, | ||
21 | ERR_DIVISION_BY_ZERO, | ||
22 | } ErrorValue; | ||
23 | |||
24 | typedef struct Error { | ||
25 | ErrorType type; | ||
26 | ErrorValue value; | ||
27 | size_t line; | ||
28 | size_t col; | ||
29 | } Error; | ||
30 | 2 | ||
31 | static const char* error_msgs[] = { | 3 | static const char* error_msgs[] = { |
32 | [ERR_UNKNOWN] = "error: something unexpected happened", | 4 | [ERR_UNKNOWN] = "error: something unexpected happened", |
@@ -45,7 +17,6 @@ static const char* error_msgs[] = { | |||
45 | [ERR_DIVISION_BY_ZERO] = "error: division by zero", | 17 | [ERR_DIVISION_BY_ZERO] = "error: division by zero", |
46 | }; | 18 | }; |
47 | 19 | ||
48 | #define ERR_MAX_NUMBER 16 | ||
49 | static Error errors[ERR_MAX_NUMBER]; | 20 | static Error errors[ERR_MAX_NUMBER]; |
50 | static size_t errors_n = 0; | 21 | static size_t errors_n = 0; |
51 | static bool supress_errors = false; | 22 | static bool supress_errors = false; |