Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherrorgen.cpp
More file actions
Latest commit
148 lines (135 loc) · 6.08 KB
/
Copy patherrorgen.cpp
File metadata and controls
148 lines (135 loc) · 6.08 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
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
//
// Created by ahmad on 1/12/16.
//
#include<stdio.h>
#include"errorgen.h"
bool errorOccuerd;
voidgenerateErr(int lineNum, int errorCode, char *parameter, char *file)
{
errorOccuerd = true;
printf("error #%o : ",errorCode);
switch (errorCode)
{
caseERR_FILE_NOT_FOUND:
printf("The file '%s' is not existing.\n",parameter);
break;
caseERR_SINGLE_CUOT_NOTCLOSE:
printf("Expected to have ' for characters in line %d of the file '%s'.\n",lineNum,file);
break;
caseERR_UNKNOWN_PREPROCESS:
printf("'%s' is an unknow preprecess command in the file '%s'.\n",parameter,file);
break;
caseERR_SYNTAX_IN_PREPROCESS:
printf("Syntax error occured in the preprocess of file '%s'. A cuotation should be used to determine the path of the desired include file.\n",file);
break;
caseERR_PUNCT_NOT_EXPECTED:
printf("The punctuation mark %s is not expected to be in line %d of the file %s.\n",parameter,lineNum,file);
break;
caseERR_PUNCT_CLOSE_EXPECTED:
printf("The punctuation mark %s expected to be closed in line %d of the file %s.\n",parameter,lineNum,file);
break;
caseERR_OPERATOR_NOT_OVERLODED:
printf("The operator %s used in line %d is not overloaded yet.\n",parameter,lineNum);
break;
caseERR_DEF_VAR:
printf("The identifier '%s' that is declaring in line %d, was declared before.\n",parameter,lineNum);
break;
caseERR_NOT_DEF_VAR:
printf("The identifier '%s' is using in line %d without being declared.\n",parameter,lineNum);
break;
caseERR_NOT_INIT_VAR:
printf("The identifier '%s' is using in line %d without being initialized and has no proper value.\n",parameter,lineNum);
break;
caseERR_AFTER_PARENTHESIS_OPEN:
printf("After ( just an identifier, an operator, a number or another ( should be seen in line %d.\n",lineNum);
break;
caseERR_AFTER_PARENTHESIS_CLOSE:
printf("After ) just an identifier, an operator, a number or another ) should be seen in line %d.\n",lineNum);
break;
caseERR_AFTER_OPR:
printf("After an operator an identifier, (, or a number should be seen in line %d.\n",lineNum);
break;
caseERR_REPLACE:
printf("In line %d should be %s.",lineNum,parameter);
break;
caseERR_ASSIGN_TO_NUMBER:
printf("Nothing could be assigned to a number in line %d.\n",lineNum);
break;
caseERR_AFTER_NULL:
printf("After NULL should be %s in line %d.\n", parameter, lineNum);
break;
caseERR_NULL_NOT_OPERATABLE:
printf("Null in the line %d is not operatble and could not add to anything\n",lineNum);
break;
caseERR_OPERATOR_OR_:
printf("Operator or %s should be put in line %d\n",parameter,lineNum);
break;
caseERR_ID_OR_NUM:
printf("An identifier or a number should be in line %d.\n",lineNum);
break;
caseERR_AFTER_IF_OR_WHILE_PARENTHESIS_OPEN:
printf("After the keyword %s bucn of () should be open and close in line %d.\n",parameter,lineNum);
break;
caseERR_AFTER_ELSE_BRACE_OPEN:
printf("After the ELSE statement in line %d, a { should be seen.\n",lineNum);
break;
caseERR_ASSIGN_OR_SEMICOLON:
printf("In line %d should be = or ;.\n",lineNum);
break;
caseERR_SHOULD_DECLARE_ID:
printf("In line %d an identifier should be declared.\n",lineNum);
break;
caseERR_SEMICOLON_NEEDED:
printf("In line %d an semicolon is needed.\n",lineNum);
break;
caseERR_BOOL_TYPE_MISMATCH:
printf("An identifier of type bool can't accept any values excepts TRUE or FALSE in line %d.\n",lineNum);
break;
caseERR_ASSIGNMENT_EXPECTED:
printf("Here = should be seen in line %d.\n",lineNum);
break;
caseERR_CHAR_TYPE_MISMATCH:
printf("An identifier of type char can't accept any values excepts char types in line %d.\n",lineNum);
break;
caseERR_MAIN_SCOPE_START:
printf("Main scope should be started with in line %d.\n",lineNum);
break;
caseERR_MAIN_PARENTHESIS:
printf("After ( in line %d should not anything be seen except ).\n",lineNum);
break;
caseERR_MAIN_AFTER_VOID:
printf("After a void data type in line %d, the main funcion should be come.\n",lineNum);
break;
caseERR_KEYWORD_EXPECTED:
printf("A keyword expected to be in line %d.\n",lineNum);
break;
caseERR_TWO_MAIN:
printf("Main function can be implemented one time per an application. It is redifed in line %d.\n",lineNum);
break;
caseERR_STATE_AFTER_MAIN:
printf("The statements that came in line %d is out of main scope and could not be executed.\n",lineNum);
break;
caseERR_NO_VOID_TYPE_ID:
printf("Void type used in line %d cannot to be used for defining any other identifier exept main function.\n",lineNum);
break;
caseERR_TYPE_MISSMATCH_INT_TO_CHAR:
printf("Type missmatch occured in line %d. Just a vlue of char can be assigned to a char varaible.\n",lineNum);
break;
caseERR_SEMICOLON_AFTER_RETURN:
printf("After the return statement in line %d should be a semicolon.\n",lineNum);
break;
}
}
voidgenerateWar(int lineNum, int warningCode, char *parameter, char *file)
{
printf("warning #%o : ",warningCode);
switch (warningCode) {
caseWAR_AFTER_RETURN_STATEMENT:
printf("The statement(s) after the return statement in line %d won't be executed.\n", lineNum);
break;
}
}
boolisAnyErr()
{
return errorOccuerd;
}