Skip to content
Snippets Groups Projects
Commit 7f298a9e authored by expan's avatar expan
Browse files

Fix to use atoms

parent cf1032eb
No related branches found
No related tags found
1 merge request!1SQLP parser with cons cells
...@@ -32,7 +32,7 @@ cons_cell* parse(char* input, int size) { ...@@ -32,7 +32,7 @@ cons_cell* parse(char* input, int size) {
char buff_first[500]; char buff_first[500];
strncpy(buff_first, input, first_space_idx); strncpy(buff_first, input, first_space_idx);
cons_cell* car_cons = parse(buff_first, first_space_idx); cons_cell* car_cons = create_cons_cell_w_atom(buff_first, NULL);
char buff_other[500]; char buff_other[500];
int next_char = first_space_idx; int next_char = first_space_idx;
while (input[next_char] == ' ' && input[next_char] != NULL) { while (input[next_char] == ' ' && input[next_char] != NULL) {
...@@ -41,7 +41,8 @@ cons_cell* parse(char* input, int size) { ...@@ -41,7 +41,8 @@ cons_cell* parse(char* input, int size) {
strncpy(buff_other, input[next_char], size - next_char); strncpy(buff_other, input[next_char], size - next_char);
cons_cell* cdr_cons = parse(buff_other, size-next_char); cons_cell* cdr_cons = parse(buff_other, size-next_char);
return create_cons_cell(car_cons, cdr_cons); car_cons->cdr = cdr_cons;
return car_cons;
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment