diff options
Diffstat (limited to 'src/symboltable.c')
-rw-r--r-- | src/symboltable.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/symboltable.c b/src/symboltable.c index 5c63d3f..d20b0dc 100644 --- a/src/symboltable.c +++ b/src/symboltable.c | |||
@@ -94,6 +94,12 @@ int loc_lookup(const char name[]) { | |||
94 | return loc_symbol_table.entries[count].type; | 94 | return loc_symbol_table.entries[count].type; |
95 | } | 95 | } |
96 | } | 96 | } |
97 | //Check in global table | ||
98 | for (count = 0; count < glo_symbol_table.size; count++) { | ||
99 | if (!strcmp(glo_symbol_table.entries[count].name, name)) { | ||
100 | return glo_symbol_table.entries[count].type; | ||
101 | } | ||
102 | } | ||
97 | fprintf(stderr, "No definition of the variable %s near line %d\n", name, | 103 | fprintf(stderr, "No definition of the variable %s near line %d\n", name, |
98 | lineno); | 104 | lineno); |
99 | return -1; | 105 | return -1; |