changeset 1577:911ebbd23919

Fix parsing conflict
author Adam Chlipala <adam@chlipala.net>
date Sat, 15 Oct 2011 13:30:59 -0400
parents f6c74b4bc4e6
children 7d2aa0ddc531
files src/urweb.grm
diffstat 1 files changed, 15 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/urweb.grm	Sat Oct 15 10:31:30 2011 -0400
+++ b/src/urweb.grm	Sat Oct 15 13:30:59 2011 -0400
@@ -298,6 +298,7 @@
  | mpath of string list
 
  | cexp of con
+ | cexpO of con option
  | capps of con
  | cterm of con
  | ctuple of con list
@@ -703,16 +704,24 @@
        | sgntm WHERE LTYPE SYMBOL EQ cexp(SgnWhere (sgntm, SYMBOL, cexp), s (sgntmleft, cexpright))
        | LPAREN sgn RPAREN              (sgn)
 
-sgi    : CON SYMBOL DCOLON kind         ((SgiConAbs (SYMBOL, kind), s (CONleft, kindright)))
-       | LTYPE SYMBOL                   ((SgiConAbs (SYMBOL, (KType, s (LTYPEleft, SYMBOLright))),
+cexpO  :                                (NONE)
+       | EQ cexp                        (SOME cexp)
+
+sgi    : LTYPE SYMBOL                   ((SgiConAbs (SYMBOL, (KType, s (LTYPEleft, SYMBOLright))),
                                           s (LTYPEleft, SYMBOLright)))
-       | CON SYMBOL cargl2 kopt EQ cexp (let
-                                             val loc = s (CONleft, cexpright)
+       | CON SYMBOL cargl2 kopt cexpO   (let
+                                             val loc = s (CONleft, cexpOright)
 
                                              val k = Option.getOpt (kopt, (KWild, loc))
-                                             val (c, k) = cargl2 (cexp, k)
                                          in
-                                             (SgiCon (SYMBOL, SOME k, c), loc)
+                                             case cexpO of
+                                                 NONE => (SgiConAbs (SYMBOL, k), loc)
+                                               | SOME cexp =>
+                                                 let
+                                                     val (c, k) = cargl2 (cexp, k)
+                                                 in
+                                                     (SgiCon (SYMBOL, SOME k, c), loc)
+                                                 end
                                          end)
        | LTYPE SYMBOL EQ cexp           ((SgiCon (SYMBOL, SOME (KType, s (LTYPEleft, cexpright)), cexp),
                                           s (LTYPEleft, cexpright)))