summaryrefslogtreecommitdiff
path: root/src/urweb.grm
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2008-08-31 16:54:13 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2008-08-31 16:54:13 -0400
commit83431c3e4c3fa74cae515520be04a0be3c11fef2 (patch)
treeb7d5f19b05bbef691eeeb0b4103fe952bcb42cb2 /src/urweb.grm
parent3b3eb1273341bcc8787ab2efa9f7fe7cfd2f9235 (diff)
Monoize ASC/DESC
Diffstat (limited to 'src/urweb.grm')
-rw-r--r--src/urweb.grm23
1 files changed, 17 insertions, 6 deletions
diff --git a/src/urweb.grm b/src/urweb.grm
index 51c104d7..6cb41890 100644
--- a/src/urweb.grm
+++ b/src/urweb.grm
@@ -178,6 +178,7 @@ fun native_op (oper, e1, e2, loc) =
| LIMIT | OFFSET | ALL
| TRUE | FALSE | CAND | OR | NOT
| COUNT | AVG | SUM | MIN | MAX
+ | ASC | DESC
| NE | LT | LE | GT | GE
%nonterm
@@ -270,7 +271,9 @@ fun native_op (oper, e1, e2, loc) =
| gopt of group_item list option
| hopt of exp
| obopt of exp
+ | obitem of exp * exp
| obexps of exp
+ | diropt of exp
| lopt of exp
| ofopt of exp
| sqlint of exp
@@ -1022,26 +1025,34 @@ obopt : (ECApp ((EVar (["Basis"], "sql_order_by_
dummy)
| ORDER BY obexps (obexps)
-obexps : sqlexp (let
- val loc = s (sqlexpleft, sqlexpright)
+obitem : sqlexp diropt (sqlexp, diropt)
+
+obexps : obitem (let
+ val loc = s (obitemleft, obitemright)
val e' = (ECApp ((EVar (["Basis"], "sql_order_by_Nil"), loc),
(CWild (KRecord (KType, loc), loc), loc)),
loc)
val e = (EApp ((EVar (["Basis"], "sql_order_by_Cons"), loc),
- sqlexp), loc)
+ #1 obitem), loc)
+ val e = (EApp (e, #2 obitem), loc)
in
(EApp (e, e'), loc)
end)
- | sqlexp COMMA obexps (let
- val loc = s (sqlexpleft, obexpsright)
+ | obitem COMMA obexps (let
+ val loc = s (obitemleft, obexpsright)
val e = (EApp ((EVar (["Basis"], "sql_order_by_Cons"), loc),
- sqlexp), loc)
+ #1 obitem), loc)
+ val e = (EApp (e, #2 obitem), loc)
in
(EApp (e, obexps), loc)
end)
+diropt : (EVar (["Basis"], "sql_asc"), dummy)
+ | ASC (EVar (["Basis"], "sql_asc"), s (ASCleft, ASCright))
+ | DESC (EVar (["Basis"], "sql_desc"), s (DESCleft, DESCright))
+
lopt : (EVar (["Basis"], "sql_no_limit"), dummy)
| LIMIT ALL (EVar (["Basis"], "sql_no_limit"), dummy)
| LIMIT sqlint (let