aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--parsing/g_constrnew.ml412
1 files changed, 8 insertions, 4 deletions
diff --git a/parsing/g_constrnew.ml4 b/parsing/g_constrnew.ml4
index 9a9cf9a59..6fa833275 100644
--- a/parsing/g_constrnew.ml4
+++ b/parsing/g_constrnew.ml4
@@ -255,7 +255,7 @@ GEXTEND Gram
| -> None ] ]
;
match_constr:
- [ [ "match"; ci=LIST1 case_item SEP ","; ty=case_type; "with";
+ [ [ "match"; ci=LIST1 case_item SEP ","; ty=OPT case_type; "with";
br=branches; "end" -> mk_match (loc,ci,ty,br) ] ]
;
case_item:
@@ -270,11 +270,15 @@ GEXTEND Gram
ty = OPT ["in"; t=lconstr -> t] -> (ona,ty) ] ]
;
case_type:
- [ [ ty = OPT [ "return"; c = operconstr LEVEL "100" -> c ] -> ty ] ]
+ [ [ "return"; ty = operconstr LEVEL "100" -> ty ] ]
;
return_type:
- [ [ na = ["as"; id=name -> snd id | -> Names.Anonymous];
- ty = case_type -> (na,ty) ] ]
+ [ [ a = OPT [ na = ["as"; id=name -> snd id | -> Names.Anonymous];
+ ty = case_type -> (na,ty) ] ->
+ match a with
+ | None -> Names.Anonymous, None
+ | Some (na,t) -> (na, Some t)
+ ] ]
;
branches:
[ [ OPT"|"; br=LIST0 eqn SEP "|" -> br ] ]