Mercurial > urweb
changeset 1425:139d019c7237
Syntactic sugar for grouping by variable numbers of columns
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Thu, 17 Feb 2011 18:05:08 -0500 |
parents | 7f6ac9f33d4d |
children | 6365d10cd326 |
files | src/urweb.grm |
diffstat | 1 files changed, 4 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/urweb.grm Thu Feb 17 14:18:18 2011 -0500 +++ b/src/urweb.grm Thu Feb 17 18:05:08 2011 -0500 @@ -51,6 +51,7 @@ datatype group_item = GField of con * con + | GFields of con * con fun eqTnames ((c1, _), (c2, _)) = case (c1, c2) of @@ -107,13 +108,14 @@ 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 @@ | 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)