From 53eab39682fe74b6ef489d2c3b45a00c4611fb3a Mon Sep 17 00:00:00 2001
From: Wanxin Li <wanxin.li@uwaterloo.ca>
Date: Fri, 16 Aug 2019 20:11:57 -0400
Subject: [PATCH] fix create_limit_operator

---
 SQLPGrammar_new.y | 8 +++++++-
 util_new.c        | 2 +-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/SQLPGrammar_new.y b/SQLPGrammar_new.y
index 7920588..4fd9e44 100644
--- a/SQLPGrammar_new.y
+++ b/SQLPGrammar_new.y
@@ -43,7 +43,7 @@ Query
 		printf("Query 3\n");
 		$$ = $1;
 	}
-	| SelectQuery LIMIT INTEGER
+	| SelectQuery LIMIT Integer
 	{
 		printf("Query 4\n");
 		$$ = create_limit_operator($1, $3);
@@ -292,6 +292,12 @@ Term
 	}
 
 
+Integer
+	: INTEGER
+	{
+		printf("INTEGER is |%s|", yytext);
+		$$ = create_constant(yytext);
+	}
 
 
 Constant
diff --git a/util_new.c b/util_new.c
index 4ecb246..df9d37f 100644
--- a/util_new.c
+++ b/util_new.c
@@ -179,7 +179,7 @@ cons_cell* create_exist_operator(cons_cell* ra1) {
 	return create_cons_cell_w_atom(operator, ra1_cons);
 }
 
-
+// todo: ra2 number doesn't apprear in the parse tree
 cons_cell* create_limit_operator(cons_cell* ra1, cons_cell* ra2) {
 	cons_cell* ra2_cons = create_cons_cell(ra2, NULL);
 	cons_cell* ra1_cons = create_cons_cell(ra1, ra2_cons);
-- 
GitLab