comparison src/urweb.grm @ 268:bacd0ba869e1

Monoize ASC/DESC
author Adam Chlipala <adamc@hcoop.net>
date Sun, 31 Aug 2008 16:54:13 -0400
parents 32f9212583b2
children 5f6a60b7ab00
comparison
equal deleted inserted replaced
267:f31e8da68e90 268:bacd0ba869e1
176 | SELECT | FROM | AS | CWHERE | GROUP | ORDER | BY | HAVING 176 | SELECT | FROM | AS | CWHERE | GROUP | ORDER | BY | HAVING
177 | UNION | INTERSECT | EXCEPT 177 | UNION | INTERSECT | EXCEPT
178 | LIMIT | OFFSET | ALL 178 | LIMIT | OFFSET | ALL
179 | TRUE | FALSE | CAND | OR | NOT 179 | TRUE | FALSE | CAND | OR | NOT
180 | COUNT | AVG | SUM | MIN | MAX 180 | COUNT | AVG | SUM | MIN | MAX
181 | ASC | DESC
181 | NE | LT | LE | GT | GE 182 | NE | LT | LE | GT | GE
182 183
183 %nonterm 184 %nonterm
184 file of decl list 185 file of decl list
185 | decls of decl list 186 | decls of decl list
268 | groupi of group_item 269 | groupi of group_item
269 | groupis of group_item list 270 | groupis of group_item list
270 | gopt of group_item list option 271 | gopt of group_item list option
271 | hopt of exp 272 | hopt of exp
272 | obopt of exp 273 | obopt of exp
274 | obitem of exp * exp
273 | obexps of exp 275 | obexps of exp
276 | diropt of exp
274 | lopt of exp 277 | lopt of exp
275 | ofopt of exp 278 | ofopt of exp
276 | sqlint of exp 279 | sqlint of exp
277 | sqlagg of string 280 | sqlagg of string
278 281
1020 obopt : (ECApp ((EVar (["Basis"], "sql_order_by_Nil"), dummy), 1023 obopt : (ECApp ((EVar (["Basis"], "sql_order_by_Nil"), dummy),
1021 (CWild (KRecord (KType, dummy), dummy), dummy)), 1024 (CWild (KRecord (KType, dummy), dummy), dummy)),
1022 dummy) 1025 dummy)
1023 | ORDER BY obexps (obexps) 1026 | ORDER BY obexps (obexps)
1024 1027
1025 obexps : sqlexp (let 1028 obitem : sqlexp diropt (sqlexp, diropt)
1026 val loc = s (sqlexpleft, sqlexpright) 1029
1030 obexps : obitem (let
1031 val loc = s (obitemleft, obitemright)
1027 1032
1028 val e' = (ECApp ((EVar (["Basis"], "sql_order_by_Nil"), loc), 1033 val e' = (ECApp ((EVar (["Basis"], "sql_order_by_Nil"), loc),
1029 (CWild (KRecord (KType, loc), loc), loc)), 1034 (CWild (KRecord (KType, loc), loc), loc)),
1030 loc) 1035 loc)
1031 val e = (EApp ((EVar (["Basis"], "sql_order_by_Cons"), loc), 1036 val e = (EApp ((EVar (["Basis"], "sql_order_by_Cons"), loc),
1032 sqlexp), loc) 1037 #1 obitem), loc)
1038 val e = (EApp (e, #2 obitem), loc)
1033 in 1039 in
1034 (EApp (e, e'), loc) 1040 (EApp (e, e'), loc)
1035 end) 1041 end)
1036 | sqlexp COMMA obexps (let 1042 | obitem COMMA obexps (let
1037 val loc = s (sqlexpleft, obexpsright) 1043 val loc = s (obitemleft, obexpsright)
1038 1044
1039 val e = (EApp ((EVar (["Basis"], "sql_order_by_Cons"), loc), 1045 val e = (EApp ((EVar (["Basis"], "sql_order_by_Cons"), loc),
1040 sqlexp), loc) 1046 #1 obitem), loc)
1047 val e = (EApp (e, #2 obitem), loc)
1041 in 1048 in
1042 (EApp (e, obexps), loc) 1049 (EApp (e, obexps), loc)
1043 end) 1050 end)
1051
1052 diropt : (EVar (["Basis"], "sql_asc"), dummy)
1053 | ASC (EVar (["Basis"], "sql_asc"), s (ASCleft, ASCright))
1054 | DESC (EVar (["Basis"], "sql_desc"), s (DESCleft, DESCright))
1044 1055
1045 lopt : (EVar (["Basis"], "sql_no_limit"), dummy) 1056 lopt : (EVar (["Basis"], "sql_no_limit"), dummy)
1046 | LIMIT ALL (EVar (["Basis"], "sql_no_limit"), dummy) 1057 | LIMIT ALL (EVar (["Basis"], "sql_no_limit"), dummy)
1047 | LIMIT sqlint (let 1058 | LIMIT sqlint (let
1048 val loc = s (LIMITleft, sqlintright) 1059 val loc = s (LIMITleft, sqlintright)