Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
LDI
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Grant Weddell
LDI
Commits
e5298636
Commit
e5298636
authored
5 years ago
by
JasonJPu
Browse files
Options
Downloads
Plain Diff
Finish merge
parents
9bd7447e
6b5994f4
No related branches found
No related tags found
1 merge request
!1
SQLP parser with cons cells
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
SQLPGrammar.y
+4
-4
4 additions, 4 deletions
SQLPGrammar.y
util.c
+13
-15
13 additions, 15 deletions
util.c
util.o
+0
-0
0 additions, 0 deletions
util.o
with
17 additions
and
19 deletions
SQLPGrammar.y
+
4
−
4
View file @
e5298636
...
@@ -62,11 +62,11 @@ Body
...
@@ -62,11 +62,11 @@ Body
TablePath
TablePath
: TableIdentifier VarIdentifier
: TableIdentifier VarIdentifier
{ printf("last table path\n");
{ printf("last table path\n");
$$ = create_a
ssign
_operator($1, $2);
$$ = create_a
tom
_operator($1, $2);
}
}
| TableIdentifier VarIdentifier ',' TablePath
| TableIdentifier VarIdentifier ',' TablePath
{ printf("table path2\n");
{ printf("table path2\n");
$$ = create_cross_operator(create_a
ssign
_operator($1, $2), $4);
$$ = create_cross_operator(create_a
tom
_operator($1, $2), $4);
}
}
;
;
...
@@ -89,11 +89,11 @@ Select_List
...
@@ -89,11 +89,11 @@ Select_List
}
}
| Col
| Col
{ printf("select list attr path\n");
{ printf("select list attr path\n");
$$ = create_
rename
_operator($1,
$1,
NULL);
$$ = create_
assign
_operator($1, NULL);
}
}
| Col ',' Select_List
| Col ',' Select_List
{ printf("Select list\n");
{ printf("Select list\n");
$$ = create_
rename
_operator($1,
$1,
$2);
$$ = create_
assign
_operator($1, $2);
}
}
;
;
...
...
This diff is collapsed.
Click to expand it.
util.c
+
13
−
15
View file @
e5298636
...
@@ -121,25 +121,23 @@ cons_cell* create_cross_operator(cons_cell* ra1, cons_cell* ra2) {
...
@@ -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
// 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
)
{
// THIS DOESN"T WORK FOR JASON"S COMPILER SO REVERTING BACK BUT LEFT HERE IN CASE WE NEED IT LATER XD
cons_cell
*
new_name_cons
=
create_cons_cell
(
var
,
next
);
//cons_cell* create_rename_operator(cons_cell* column, cons_cell* var, cons_cell* next) {
cons_cell
*
original_cons
=
create_cons_cell
(
column
,
new_name_cons
);
// cons_cell* new_name_cons = create_cons_cell(var, next);
char
operator
[
7
]
=
"RENAME
\0
"
;
// cons_cell* original_cons = create_cons_cell(column, new_name_cons);
cons_cell
*
operator_cons
=
create_cons_cell_w_atom
(
operator
,
original_cons
);
// char operator[7] = "RENAME\0";
return
operator_cons
;
// 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
// 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
// cdr to get to cons atom, car to get atom itself
// if(hash == NULL)
// cons_cell* new_name_cons = create_cons_cell(var, NULL);
// hash = g_hash_table_new(g_str_hash, g_str_equal);
// cons_cell* original_cons = create_cons_cell(table, new_name_cons);
cons_cell
*
sp_col_cons
=
create_cons_cell
(
spcol
,
next
);
// 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
);
char
operator
[
3
]
=
"AS
\0
"
;
char
operator
[
3
]
=
"AS
\0
"
;
cons_cell
*
operator_cons
=
create_cons_cell_w_atom
(
operator
,
origina
l_cons
);
cons_cell
*
operator_cons
=
create_cons_cell_w_atom
(
operator
,
sp_co
l_cons
);
return
operator_cons
;
return
operator_cons
;
}
}
...
...
This diff is collapsed.
Click to expand it.
util.o
deleted
100644 → 0
+
0
−
0
View file @
9bd7447e
File deleted
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment