aboutsummaryrefslogtreecommitdiff
path: root/src/symbol_table.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/symbol_table.c')
-rw-r--r--src/symbol_table.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/symbol_table.c b/src/symbol_table.c
index 68e24f0..cff675a 100644
--- a/src/symbol_table.c
+++ b/src/symbol_table.c
@@ -217,17 +217,25 @@ static char *string_of_type(int type) {
217 return "CHAR"; 217 return "CHAR";
218 case VOID_T: 218 case VOID_T:
219 return "VOID"; 219 return "VOID";
220 case TAB:
221 return "TAB";
220 default: 222 default:
221 return "UNEXPECTED"; 223 return "UNEXPECTED";
222 } 224 }
223} 225}
224 226
225void check_expected_type(int type_to_check, int type_expected) { 227void check_expected_type(Type type_to_check, Type type_expected) {
226 if (type_to_check != type_expected) 228 if (type_to_check != type_expected)
227 fprintf(stderr, "Expected type : %s -> Got type : %s (near line %d)\n", 229 fprintf(stderr, "Expected type : %s -> Got type : %s (near line %d)\n",
228 string_of_type(type_expected), string_of_type(type_to_check), 230 string_of_type(type_expected), string_of_type(type_to_check),
229 lineno); 231 lineno);
230} 232}
233void check_expected_types(Type type_to_check, Type type_expected1, Type type_expected2) {
234 if (type_to_check != type_expected1 && type_to_check != type_expected2)
235 fprintf(stderr, "Expected type : %s OR %s-> Got type : %s (near line %d)\n",
236 string_of_type(type_expected1), string_of_type(type_expected2), string_of_type(type_to_check),
237 lineno);
238}
231 239
232/* returns false if symbol can't be found too */ 240/* returns false if symbol can't be found too */
233bool is_read_only(const char name[], Scope scope) { 241bool is_read_only(const char name[], Scope scope) {