-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy patherrors.c
More file actions
61 lines (56 loc) · 1.53 KB
/
errors.c
File metadata and controls
61 lines (56 loc) · 1.53 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include "errors.h"
// Error messages
char* errors[ERRORS_NUMBER] = {
":= symbol was expected",
"ASSIGNEMENT OR PROCEDURE was expected",
"BEGIN symbol was expected",
"A character was expected",
") symbol was expected",
"error on CONDITION ",
"DECLARATIVE PART ERROR",
": symbol was expected ",
": symboll was expected ",
"DPUN_ERROR",
"END symbol was expected",
"EXPRESSION error",
"FACTOR ERROR",
"error sequence of statements handled",
"identifier was expected",
"IS symbol was expected",
"; symbol was expected",
"symbol not found error",
"IF symbol was expected",
"Mode error",
"parameter profile errror",
"parameter specification error",
") symbol was expected",
"( symbol was expected",
"procedure was expected",
"RELATION EXPECTED ERROR",
"SEQUENCE STATEMENT ERROR",
"SIMPLE EXPRESSION ERROR",
" ' symbol was expected",
"Type error",
"TERM ERROR",
"THEN symbol was expected",
"Unrecognized character",
": symbol was expected",
"; symbol was expected",
"symbol exist error",
"LOOP symbol was expected",
"symbol not found error",
"unchangeable value of constant",
"Integer was expected",
"=> symbol was expected",
"IN symbol was expected",
};
/*
* Function called to raise an errors generated by
* the compiler
*/
void raise_error(error_code ec) {
if (ec >= ERRORS_NUMBER)
printf("Error number %i: error without a message yet on line %i \n", ec, current_line);
else
printf("Error number %i: %s on line %i \n", ec, errors[ec], current_line);
}