[Swift-commit] r5020 - provenancedb

lgadelha at ci.uchicago.edu lgadelha at ci.uchicago.edu
Mon Aug 29 15:14:28 CDT 2011


Author: lgadelha
Date: 2011-08-29 15:14:28 -0500 (Mon, 29 Aug 2011)
New Revision: 5020

Modified:
   provenancedb/ProvSQL.g
Log:
Minor fixes.


Modified: provenancedb/ProvSQL.g
===================================================================
--- provenancedb/ProvSQL.g	2011-08-29 18:32:10 UTC (rev 5019)
+++ provenancedb/ProvSQL.g	2011-08-29 20:14:28 UTC (rev 5020)
@@ -198,7 +198,7 @@
 		INTERSECT { System.out.println(" INTERSECT "); }
 		| 
 		EXCEPT { System.out.println(" EXCEPT "); }
-		) 
+		)
 		(
 		ALL { System.out.println(" ALL "); }
 		)? 
@@ -210,7 +210,13 @@
 		}
 ;
 
-squery	:	SELECT selectExpression 
+squery	:	SELECT (
+		DISTINCT
+		{
+			System.out.print(" DISTINCT ");
+		}
+		)? 
+		selectExpression 
 		{ 
 
 			System.out.print("SELECT " + selectClause);
@@ -266,10 +272,7 @@
 	;
 
 whereExpression	
-	:	c=whereAtom
-		{
-			whereClause += $c.text;
-		} 
+	:	whereAtom
 		(
 			(AND 
 			{
@@ -279,10 +282,7 @@
 			{
 				whereClause += " OR ";
 			}
-			) d=whereAtom
-			{
-				whereClause += $d.text;
-			}
+			) whereAtom
 		)* 
 	;
 
@@ -290,23 +290,62 @@
 	:	a=entityAttribute 
 		{ 
 			relations.add($a.text.split("\\.")[0]);
+			whereClause += $a.text;
 		}
 
-	OP 
-	(STRING | INT | FLOAT)
-	|	b=entityAttribute 
+	b=OP
+	{
+		whereClause += $b.text;
+	} 
+	(
+	c=STRING
+	{
+		whereClause += $c.text;
+	} 
+	| 
+	d=INT
+	{
+		whereClause += $d.text;
+	} 
+	|
+	e=FLOAT
+	{
+		whereClause += $e.text;
+	} 
+	)
+	|	f=entityAttribute 
 		{ 
-			relations.add($b.text.split("\\.")[0]);
+			relations.add($f.text.split("\\.")[0]);
+			whereClause += $f.text;
 		}
 
-	BETWEEN STRING AND STRING;
-
+	BETWEEN 
+	{
+		whereClause += " BETWEEN ";
+	} 
+	g=STRING 
+	{
+		whereClause += $g.text;
+	} 
+	AND 
+	{
+		whereClause += " AND ";
+	} 
+	h=STRING
+	{
+		whereClause += $h.text;
+	} 
+	;
+	
 entityAttribute	:	ID (DOT ID)?;
 
 OP	:	'=' | '>' | '>=' | '<' | '<=';
 
 SELECT 	:	's' 'e' 'l' 'e' 'c' 't';
 
+DISTINCT 
+	:	'd' 'i' 's' 't' 'i' 'n' 'c' 't';
+	
 WHERE	:	'w' 'h' 'e' 'r' 'e';
 
 AND	:	'a' 'n' 'd';




More information about the Swift-commit mailing list