diff src/sql.sml @ 2261:f81f1930c5d6

Fix SQL-parsing and declaration-ordering bugs.
author Ziv Scully <ziv@mit.edu>
date Wed, 30 Sep 2015 00:33:52 -0400
parents 565da55a4e18
children f8903af753ff
line wrap: on
line diff
--- a/src/sql.sml	Mon Sep 28 22:16:51 2015 -0400
+++ b/src/sql.sml	Wed Sep 30 00:33:52 2015 -0400
@@ -321,7 +321,7 @@
 
 fun arithmetic pExp = follow (const "(")
                              (follow pExp
-                                     (follow (altL (map const [" + ", " - ", " * ", " / "]))
+                                     (follow (altL (map const [" + ", " - ", " * ", " / ", " >> ", " << "]))
                                              (follow pExp (const ")"))))
 
 val unmodeled = altL [const "COUNT(*)",
@@ -445,9 +445,11 @@
 val delete = log "delete"
                  (wrap (follow (const "DELETE FROM ")
                                (follow uw_ident
-                                       (follow (follow (opt (const " AS T_T")) (const " WHERE "))
-                                               sqexp)))
-                       (fn ((), (tab, (_, es))) => (tab, es)))
+                                       (follow (opt (const " AS T_T"))
+                                               (opt (follow (const " WHERE ") sqexp)))))
+                       (fn ((), (tab, (_, wher))) => (tab, case wher of
+                                                               SOME (_, es) => es
+                                                             | NONE => SqTrue)))
 
 val setting = log "setting"
                   (wrap (follow uw_ident (follow (const " = ") sqexp))