summaryrefslogtreecommitdiff
path: root/src/urweb.grm
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adam@chlipala.net>2011-02-17 18:05:08 -0500
committerGravatar Adam Chlipala <adam@chlipala.net>2011-02-17 18:05:08 -0500
commit563c8f0612d5ebef309f3c9ef76cfddbaebae5d7 (patch)
tree8a81bc7a00e8f53fdc3afea10aa7757654acc1ed /src/urweb.grm
parent94a29d801a6cf86291a8c5bbf88802f3d2b4338a (diff)
Syntactic sugar for grouping by variable numbers of columns
Diffstat (limited to 'src/urweb.grm')
-rw-r--r--src/urweb.grm5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/urweb.grm b/src/urweb.grm
index 40cfd2de..c6f2587f 100644
--- a/src/urweb.grm
+++ b/src/urweb.grm
@@ -51,6 +51,7 @@ datatype select =
datatype group_item =
GField of con * con
+ | GFields of con * con
fun eqTnames ((c1, _), (c2, _)) =
case (c1, c2) of
@@ -107,13 +108,14 @@ fun amend_group loc (gi, tabs) =
let
val (tx, c) = case gi of
GField (tx, fx) => (tx, (CRecord ([(fx, (CWild (KType, loc), loc))]), loc))
+ | GFields (tx, fxs) => (tx, fxs)
val (tabs, found) = ListUtil.foldlMap (fn ((tx', c'), found) =>
if eqTnames (tx, tx') then
((tx', (CConcat (c, c'), loc)), true)
else
((tx', c'), found))
- false tabs
+ false tabs
in
if found then
()
@@ -1871,6 +1873,7 @@ wopt : (sql_inject (EVar (["Basis"], "True", In
| CWHERE sqlexp (sqlexp)
groupi : tident DOT fident (GField (tident, fident))
+ | tident DOT LBRACE LBRACE cexp RBRACE RBRACE (GFields (tident, cexp))
groupis: groupi ([groupi])
| groupi COMMA groupis (groupi :: groupis)