[Checkins] SVN: Sandbox/adamg/ocql/branches/dbprovider/src/ocql/parser/ modify the grammar rules implementation to run the failing tests

Charith Paranaliyanage paranaliyanage at gmail.com
Wed Jun 25 21:55:10 EDT 2008


Log message for revision 87780:
  modify the grammar rules implementation to run the failing tests

Changed:
  U   Sandbox/adamg/ocql/branches/dbprovider/src/ocql/parser/parser.txt
  U   Sandbox/adamg/ocql/branches/dbprovider/src/ocql/parser/queryparser.py

-=-
Modified: Sandbox/adamg/ocql/branches/dbprovider/src/ocql/parser/parser.txt
===================================================================
--- Sandbox/adamg/ocql/branches/dbprovider/src/ocql/parser/parser.txt	2008-06-26 01:55:02 UTC (rev 87779)
+++ Sandbox/adamg/ocql/branches/dbprovider/src/ocql/parser/parser.txt	2008-06-26 01:55:08 UTC (rev 87780)
@@ -5,15 +5,15 @@
 
 
     #FAILS, why?
-    #>>> QueryParser("set [ ]")(None)
-    #Query(<type 'set'>, , Constant(1))
+    >>> QueryParser("set [ ]")(None)
+    Query(<type 'set'>, , None)
 
     >>> QueryParser("set [ | 1 ]")(None)
     Query(<type 'set'>, , Constant(1))
 
     #FAILS, why?
-    #>>> QueryParser("list [ | 1 ]")(None)
-    #Query(<type 'set'>, , Constant(1))
+    >>> QueryParser("list [ | 1 ]")(None)
+    Query(<type 'list'>, , Constant(1))
 
     >>> QueryParser("set [ | 1 ] union set [|2]")(None)
     Union(Query(<type 'set'>, , Constant(1)), Query(<type 'set'>, , Constant(2)))

Modified: Sandbox/adamg/ocql/branches/dbprovider/src/ocql/parser/queryparser.py
===================================================================
--- Sandbox/adamg/ocql/branches/dbprovider/src/ocql/parser/queryparser.py	2008-06-26 01:55:02 UTC (rev 87779)
+++ Sandbox/adamg/ocql/branches/dbprovider/src/ocql/parser/queryparser.py	2008-06-26 01:55:08 UTC (rev 87780)
@@ -96,7 +96,7 @@
 
     # Tokens
     def t_TYPE(self, t):
-        r'(set|bag|map)'
+        r'(set|bag|map|list)'
         return t
 
     def t_UNION(self, t):
@@ -246,6 +246,13 @@
         t[0] = Differ(self.metadata, self.symbols, t[1], t[3])
         if DEBUG: print t[0]
 
+    def p_expr_equery(self, t):
+        r'''expr : TYPE SQUAREL xprs SQUARER
+            nexpr : TYPE SQUAREL xprs SQUARER
+        '''
+        #I also change the expected query in parser.txt
+        t[0] = Query(self.metadata, self.symbols, self.types[t[1]],t[3],None)
+        
     def p_expr_query(self, t):
         r'''expr : TYPE SQUAREL xprs PIPE expr SQUARER
             nexpr : TYPE SQUAREL xprs PIPE expr SQUARER
@@ -322,7 +329,7 @@
             nexpr : IDENTIFIER BRACEL exprs BRACER
         '''
         raise NotImplementedError("Function call")
-
+    
     def p_expr_const(self, t):
         r'''expr : CONSTANT
             nexpr : CONSTANT



More information about the Checkins mailing list