From dbcdafb1a0e6515e048baaffe652fa9a0dda4b5c Mon Sep 17 00:00:00 2001 From: Meyer Simon Date: Fri, 21 Feb 2025 10:09:26 -0500 Subject: [PATCH] fixed some of the spacing in the table t#29 --- print_symbol_table.c | 6 +++--- symbol_table.h | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/print_symbol_table.c b/print_symbol_table.c index 91393e8..0121538 100644 --- a/print_symbol_table.c +++ b/print_symbol_table.c @@ -4,7 +4,7 @@ void print_symbol_table(SymbolTable *table, FILE *file_ptr){ if(table->Parent_Scope == NULL){ - fprintf(file_ptr, "%-17s:%-8s:%-8s:%-22s:%-29s\n", "NAME", "SCOPE", "PARANT", "TYPE", "Extra annotation"); + fprintf(file_ptr, "%-17s: %-6s : %-6s : %-21s: %-28s\n", "NAME", "SCOPE", "PARANT", "TYPE", "Extra annotation"); } TableNode * entrie = table->entries; fprintf(file_ptr, "-----------------:--------:--------:----------------------:-----------------------------\n"); @@ -18,7 +18,7 @@ void print_symbol_table(SymbolTable *table, FILE *file_ptr){ } for(; entrie != NULL; entrie = entrie->next){ - fprintf(file_ptr, "%-17s: %06d : %06d :%-22s:%-29s\n", + fprintf(file_ptr, "%-17s: %06d : %06d : %-21s: %-28s\n", entrie->theName, current_scope, parant_scope, entrie->theType, "Extra annotation"); } @@ -34,6 +34,7 @@ void print_symbol_table(SymbolTable *table, FILE *file_ptr){ } /* +*/ int main(void){ SymbolTable * parant = CreateScope(NULL, 1,1); // Value* v = calloc(1, sizeof(Value)); @@ -59,4 +60,3 @@ int main(void){ print_symbol_table(parant, stderr); return 0; } -*/ diff --git a/symbol_table.h b/symbol_table.h index 539f2e4..1e002d0 100644 --- a/symbol_table.h +++ b/symbol_table.h @@ -32,3 +32,7 @@ typedef struct SymbolTable{ int Line_Number; int Column_Number; }SymbolTable; + + +TableNode* CreateEntry(SymbolTable* table, char* typeOf, char* id, Value* value, int StringLength); +SymbolTable* CreateScope(SymbolTable* ParentScope, int Line, int Column);