This commit is contained in:
Pedro 2014-10-08 19:09:47 -07:00
parent 592d427f7a
commit 0e5477f916
5 changed files with 25 additions and 25 deletions

View File

@ -42,10 +42,10 @@ typedef void* yyscan_t;
Statement* statement;
SelectStatement* select_statement;
TableRef* table;
Expression* expr;
Expr* expr;
List<char*>* slist;
List<Expression*>* explist;
List<Expr*>* explist;
}
%token SELECT FROM GROUP BY WHERE NOT AND OR
@ -131,15 +131,15 @@ comparison_predicate:
expr:
column_name { $$ = new Expression($1); }
| NAME '(' column_name ')' { $$ = new Expression($3, $1); }
column_name { $$ = new Expr($1); }
| NAME '(' column_name ')' { $$ = new Expr($3, $1); }
;
/* Lists */
expr_list:
expr { $$ = new List<Expression*>($1); }
expr { $$ = new List<Expr*>($1); }
| expr_list ',' expr { $1->push_back($3); $$ = $1; }
;

17
src/lib/Expr.h Normal file
View File

@ -0,0 +1,17 @@
#ifndef __EXPRESSION_H__
#define __EXPRESSION_H__
#include <cstdlib>
class Expr {
public:
Expr(char* name) : name(name), func_name(NULL) {};
Expr(char* name, char* func_name) : name(name), func_name(func_name) {};
char* name;
char* func_name;
};
#endif

View File

@ -1,17 +0,0 @@
#ifndef __EXPRESSION_H__
#define __EXPRESSION_H__
#include <cstdlib>
class Expression {
public:
Expression(char* name) : name(name), func_name(NULL) {};
Expression(char* name, char* func_name) : name(name), func_name(func_name) {};
char* name;
char* func_name;
};
#endif

View File

@ -5,7 +5,7 @@
#ifndef __STATEMENT_H__
#define __STATEMENT_H__
#include "Expression.h"
#include "Expr.h"
#include "List.h"
class TableRef;
@ -32,8 +32,8 @@ public:
SelectStatement();
TableRef* _from_table;
List<Expression*>* _select_list;
List<Expression*>* _group_by;
List<Expr*>* _select_list;
List<Expr*>* _group_by;
};