diff src/urweb.grm @ 1574:644558d9c756

Extend and document 'con' syntax with arguments
author Adam Chlipala <adam@chlipala.net>
date Sat, 15 Oct 2011 10:05:13 -0400
parents 5530a8075b62
children 911ebbd23919
line wrap: on
line diff
--- a/src/urweb.grm	Sat Oct 15 09:04:41 2011 -0400
+++ b/src/urweb.grm	Sat Oct 15 10:05:13 2011 -0400
@@ -706,8 +706,14 @@
 sgi    : CON SYMBOL DCOLON kind         ((SgiConAbs (SYMBOL, kind), s (CONleft, kindright)))
        | LTYPE SYMBOL                   ((SgiConAbs (SYMBOL, (KType, s (LTYPEleft, SYMBOLright))),
                                           s (LTYPEleft, SYMBOLright)))
-       | CON SYMBOL EQ cexp             ((SgiCon (SYMBOL, NONE, cexp), s (CONleft, cexpright)))
-       | CON SYMBOL DCOLON kind EQ cexp ((SgiCon (SYMBOL, SOME kind, cexp), s (CONleft, cexpright)))
+       | CON SYMBOL cargl2 kopt EQ cexp (let
+                                             val loc = s (CONleft, cexpright)
+
+                                             val k = Option.getOpt (kopt, (KWild, loc))
+                                             val (c, k) = cargl2 (cexp, k)
+                                         in
+                                             (SgiCon (SYMBOL, SOME k, c), loc)
+                                         end)
        | LTYPE SYMBOL EQ cexp           ((SgiCon (SYMBOL, SOME (KType, s (LTYPEleft, cexpright)), cexp),
                                           s (LTYPEleft, cexpright)))
        | DATATYPE dtypes                ((SgiDatatype dtypes, s (DATATYPEleft, dtypesright)))