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.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/symbol_table.c b/src/symbol_table.c
index 08124ac..68e24f0 100644
--- a/src/symbol_table.c
+++ b/src/symbol_table.c
@@ -228,3 +228,23 @@ void check_expected_type(int type_to_check, int type_expected) {
228 string_of_type(type_expected), string_of_type(type_to_check), 228 string_of_type(type_expected), string_of_type(type_to_check),
229 lineno); 229 lineno);
230} 230}
231
232/* returns false if symbol can't be found too */
233bool is_read_only(const char name[], Scope scope) {
234 int count;
235
236 switch (scope) {
237 case LOCAL:
238 for (count = 0; count < loc_symbol_table.size; count++)
239 if (!strcmp(loc_symbol_table.entries[count].name, name))
240 return loc_symbol_table.entries[count].read_only;
241
242 case GLOBAL:
243 for (count = 0; count < glo_symbol_table.size; count++)
244 if (!strcmp(glo_symbol_table.entries[count].name, name))
245 return glo_symbol_table.entries[count].read_only;
246
247 default:
248 return false;
249 }
250}