# HG changeset patch # User Adam Chlipala # Date 1297983908 18000 # Node ID 139d019c72370736b8e3913f3415e4154a0fca1b # Parent 7f6ac9f33d4dabdca67fba32f99e370920482079 Syntactic sugar for grouping by variable numbers of columns diff -r 7f6ac9f33d4d -r 139d019c7237 src/urweb.grm --- 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)