Merge branch 'Dev' into Sprint2-Partho_Symbol_Tabke-FE-t#NoTask
This commit is contained in:
@ -36,6 +36,7 @@ SymbolTable* CreateScope(SymbolTable* ParentScope, int Line, int Column) {
|
||||
|
||||
//create entry just for things below top level scope
|
||||
TableNode* CreateEntry(SymbolTable* table, char* typeOf, char* id) {
|
||||
|
||||
if(table ==NULL || table->Parent_Scope == NULL){
|
||||
printf("Null reference to table given for create entry or given top level scope which is invalid\n");
|
||||
return NULL;
|
||||
@ -90,6 +91,7 @@ if(table_lookup(table,id) != NULL){
|
||||
newEntry->next = oldEntry;
|
||||
return newEntry;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
TableNode* table_lookup(SymbolTable* table, char* x) {
|
||||
@ -130,7 +132,10 @@ void print_symbol_table(SymbolTable* table, FILE* file_ptr) {
|
||||
} else {
|
||||
current_scope = 1001;
|
||||
}
|
||||
|
||||
if ( entrie == NULL ) {
|
||||
fprintf(file_ptr, "%-17s: %06d : %06d : %-21s: %-28s\n", "",
|
||||
current_scope, parant_scope, "", "Empty Scope");
|
||||
}
|
||||
for (; entrie != NULL; entrie = entrie->next) {
|
||||
if (parant_scope == 0) {
|
||||
fprintf(file_ptr, "%-17s: %06d : : %-21s: %-28s\n",
|
||||
|
@ -7,7 +7,6 @@ typedef struct ListOfTable {
|
||||
struct SymbolTable* table;
|
||||
// struct ListOfTable* prev;
|
||||
struct ListOfTable* next;
|
||||
|
||||
} ListOfTable;
|
||||
|
||||
typedef struct TableNode {
|
||||
|
Reference in New Issue
Block a user