diff options
author | Adam Chlipala <adam@chlipala.net> | 2011-10-15 10:05:13 -0400 |
---|---|---|
committer | Adam Chlipala <adam@chlipala.net> | 2011-10-15 10:05:13 -0400 |
commit | f1f76981bdc16abe27a76303520d78dc9df4e460 (patch) | |
tree | e838c552a1de10027dac7369ba03f950bfd12487 /src/urweb.grm | |
parent | e2a639a782d2c7be434b819156fb924c7d955f12 (diff) |
Extend and document 'con' syntax with arguments
Diffstat (limited to 'src/urweb.grm')
-rw-r--r-- | src/urweb.grm | 10 |
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))) |