summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adam@chlipala.net>2011-10-15 10:05:13 -0400
committerGravatar Adam Chlipala <adam@chlipala.net>2011-10-15 10:05:13 -0400
commitf1f76981bdc16abe27a76303520d78dc9df4e460 (patch)
treee838c552a1de10027dac7369ba03f950bfd12487 /src
parente2a639a782d2c7be434b819156fb924c7d955f12 (diff)
Extend and document 'con' syntax with arguments
Diffstat (limited to 'src')
-rw-r--r--src/urweb.grm10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/urweb.grm b/src/urweb.grm
index d39fbe55..65264cdf 100644
--- a/src/urweb.grm
+++ b/src/urweb.grm
@@ -706,8 +706,14 @@ sgntm : SIG sgis END (SgnConst sgis, s (SIGleft, ENDright))
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)))