diff --git a/SQLPGrammar.y b/SQLPGrammar.y index f3f82a7ec723f96869f12e75b2adfa388a7fc41b..f49c44a9d14fb2e11fae5bd364953f6a17f77ad7 100644 --- a/SQLPGrammar.y +++ b/SQLPGrammar.y @@ -62,11 +62,11 @@ Body TablePath : TableIdentifier VarIdentifier { printf("last table path\n"); - $$ = create_assign_operator($1, $2); + $$ = create_atom_operator($1, $2); } | TableIdentifier VarIdentifier ',' TablePath { printf("table path2\n"); - $$ = create_cross_operator(create_assign_operator($1, $2), $4); + $$ = create_cross_operator(create_atom_operator($1, $2), $4); } ; @@ -89,11 +89,11 @@ Select_List } | Col { printf("select list attr path\n"); - $$ = create_rename_operator($1, $1, NULL); + $$ = create_assign_operator($1, NULL); } | Col ',' Select_List { printf("Select list\n"); - $$ = create_rename_operator($1, $1, $2); + $$ = create_assign_operator($1, $2); } ; diff --git a/util.c b/util.c index f1e3d3752e099d6fd0ec6be4ca7c2213f7eeab22..88b4840b8187136e0037c5aa85f05232379a89f6 100644 --- a/util.c +++ b/util.c @@ -121,25 +121,23 @@ cons_cell* create_cross_operator(cons_cell* ra1, cons_cell* ra2) { } // For when you want to assign column names to another name -cons_cell* create_rename_operator(cons_cell* column, cons_cell* var, cons_cell* next) { - cons_cell* new_name_cons = create_cons_cell(var, next); - cons_cell* original_cons = create_cons_cell(column, new_name_cons); - char operator[7] = "RENAME\0"; - cons_cell* operator_cons = create_cons_cell_w_atom(operator, original_cons); - return operator_cons; -} +// THIS DOESN"T WORK FOR JASON"S COMPILER SO REVERTING BACK BUT LEFT HERE IN CASE WE NEED IT LATER XD +//cons_cell* create_rename_operator(cons_cell* column, cons_cell* var, cons_cell* next) { +// cons_cell* new_name_cons = create_cons_cell(var, next); +// cons_cell* original_cons = create_cons_cell(column, new_name_cons); +// char operator[7] = "RENAME\0"; +// cons_cell* operator_cons = create_cons_cell_w_atom(operator, original_cons); +// return operator_cons; +//} // For when you want to assign a var to a table -cons_cell* create_assign_operator(cons_cell* table, cons_cell* var) { +cons_cell* create_assign_operator(cons_cell* spcol, cons_cell* next) { // cdr to get to cons atom, car to get atom itself -// if(hash == NULL) -// hash = g_hash_table_new(g_str_hash, g_str_equal); - -// printf("test %s", ((atom*)table->cdr->car)->val); - cons_cell* new_name_cons = create_cons_cell(var, NULL); - cons_cell* original_cons = create_cons_cell(table, new_name_cons); +// cons_cell* new_name_cons = create_cons_cell(var, NULL); +// cons_cell* original_cons = create_cons_cell(table, new_name_cons); + cons_cell* sp_col_cons = create_cons_cell(spcol, next); char operator[3] = "AS\0"; - cons_cell* operator_cons = create_cons_cell_w_atom(operator, original_cons); + cons_cell* operator_cons = create_cons_cell_w_atom(operator, sp_col_cons); return operator_cons; } diff --git a/util.o b/util.o deleted file mode 100644 index 2fa3d8121cfea077faf3006291a71d604cddae08..0000000000000000000000000000000000000000 Binary files a/util.o and /dev/null differ