-
Notifications
You must be signed in to change notification settings - Fork 0
/
error-messages.h
100 lines (70 loc) · 3.61 KB
/
error-messages.h
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#ifndef PARSER_ERROR_MESSAGES_H
#define PARSER_ERROR_MESSAGES_H
typedef enum {
varNameTooLong = 1, varNameDoesntStartWithLetter = 2, expectedSemicolon = 3,
expectedIdentifier = 4, expectedPeriod = 5, expectedBecomes = 6, expectedThen = 7,
expectedDo = 8, expectedEnd = 9, invalidRelationalOperator = 10, expectedDigit = 11,
weirdNullIdentifier = 12, invalidVariableName = 13, expectedRelationalOperator = 14,
missingIdentSymbol = 15, expectedEqualSymbol = 16, missingNumberSymbol = 17,
expectedRightParentheses = 18, incompleteFactorDetected = 19, errorOpeningSymbolListFile = 20,
varWasNeverDeclared = 21, attemptToChangeConstant = 22, invalidVarInExpression = 23,
identifierNotDeclared = 24, callingConstOrVar = 25, expectedVarAfterRead = 26, expectedIdentAfterWrite = 27
} error_type;
// The order of this is with respect to error_type
char *errorMessage[27] = {
// varNameTooLong
"Variable name exceeds the maximum length for variable names",
// varNameDoesntStartWithLetter
"Variable name does not start with a letter",
// expectedSemicolon
"Expected semicolon, but not encountered",
// expectedIdentifier
"Expected identifier, but not encountered",
// expectedPeriod
"You forgot a period after 'end'",
// expectedBecomes
"Expected ':=' after variable name, but none encountered",
// expectedThen
"Expeted 'then' after conditional statement, but not encountered",
// expectedDo
"Expected 'do' after condition in while loop, but none encountered",
// expectedEnd
"Expected 'end' to complete your code, but not detected",
// invalidRelationalOperator
"Invalid relational operator detected",
// expectedDigit
"Expected a digit, but got something else instead",
// weirdNullIdentifier
"A weird situation occured in which the identifier was read as null",
// invalidVariableName
"An invalid variable name was encountered. Variables can only be letters or digits",
// expectedRelationalOperator
"Expected a relational operator, but not encountered",
// missingIdentSymbol
"Missing ident symbol in lexeme tokens. This was probably caused by the scanner",
// expectedEqualSymbol
"Expected '=', but none was encountered",
// missingNumberSymbol
"Missing number symbol in lexeme tokens. This was probably caused by the scanner",
// expectedRightParentheses
"Expected ')', but none was encountered",
// incompleteFactorDetected
"Incomplete factor was encountered. Expected an identifier, number or '(', but none were encountered",
// errorOpeningSymbolListFile
"There was an error when trying to open symlist.txt",
// varWasNeverDeclared
"You are using an identifier that has not yet been declared",
// attemptToChangeConstant
"You can not change the value of a constant",
// invalidVarInExpression
"Invalid variable in factor. You can only perform arithmitic with variables, constants or numbers",
// identifierNotDeclared
"Your are trying to use an identifier that was never declared",
// callingConstOrVar
"You are trying to call something other than a procedure after 'call', which doesn't make sense",
// expectedVarAfterRead
"Expected a var after 'read', but none was encountered",
// expectedIdentAfterWrite
"Expected an identifer after write, but none was encountered"
};
#endif //PARSER_ERROR_MESSAGES_H