This commit is contained in:
Scarlett
2025-04-02 15:03:29 -04:00
parent 20c372f134
commit 77c4106b1b
3 changed files with 63 additions and 45 deletions

View File

@ -702,7 +702,7 @@ int getAdInfoType(TableNode *tn) {
return TYPE_FUNCTION_TYPE;
}
if (strcmp(getName(tn), getName(arrayprim)) == 0) {
return TYPE_ARRAY;
return TYPE_ARRAY_TYPE; // changed from TYPE_ARRAY cuz
}
if (strcmp(getName(tn), getName(undefined)) == 0) {
return TYPE_UNDEFINED;
@ -713,7 +713,7 @@ int getAdInfoType(TableNode *tn) {
}
if(strcmp(getType(tn), getName(arrayprim))==0){
printdebug("passed in an array to getAdInfoType");
return TYPE_ARRAY;
return TYPE_ARRAY_TYPE;
}
if(strcmp(getType(tn), getName(recprime))==0){
printdebug("passed in a record to getAdInfoType");
@ -1004,8 +1004,8 @@ void print_symbol_table(SymbolTable *table, FILE *file_ptr) {
int parant_scope = 0;
int current_scope = 0;
if (table->Parent_Scope != NULL) {
parant_scope = table->Parent_Scope->Line_Number * 1000 +
table->Parent_Scope->Column_Number;
parant_scope = getParent(table)->Line_Number * 1000 +
getParent(table)->Column_Number;
current_scope =
table->Line_Number * 1000 + table->Column_Number;
} else {
@ -1015,8 +1015,8 @@ void print_symbol_table(SymbolTable *table, FILE *file_ptr) {
fprintf(file_ptr, "%-17s: %06d : %06d : %-21s: %-28s\n", "",
current_scope, parant_scope, "", "Empty Scope");
}
for (; entrie != NULL; entrie = entrie->next) {
if (getAdInfoType(entrie) == TYPE_ARRAY) {
for (; entrie != NULL; entrie = getNextEntry(entrie)) {
if (getAdInfoType(entrie) == TYPE_ARRAY_TYPE) {
if (parant_scope == 0) {
fprintf(file_ptr,
@ -1136,13 +1136,13 @@ void print_symbol_table(SymbolTable *table, FILE *file_ptr) {
}
}
}
if (table->Children_Scope != NULL) {
ListOfTable *node = table->Children_Scope;
if (getChildren(table) != NULL) {
ListOfTable *node = getChildren(table);
for (; node != NULL; node = node->next) {
print_symbol_table(node->table, file_ptr);
}
}
if (table->Parent_Scope == NULL) {
if (getParent(table) == NULL) {
fprintf(file_ptr, "-----------------:--------:--------:--------"
"--------------:-------"
"----------------------\n");