diff options
| author | Nicolas Pouillard <np@nicolaspouillard.fr> | 2010-05-17 11:59:06 +0000 |
|---|---|---|
| committer | Nicolas Pouillard <np@nicolaspouillard.fr> | 2010-05-17 11:59:06 +0000 |
| commit | 432bb22c1aa26a4329f1732d2e22761ef322476f (patch) | |
| tree | 2f5343c50e4fab8f73de6436150fce417f4d0ee6 | |
| parent | d1907eb4eb1d4d2f2f7702e262fe0c37312d7c36 (diff) | |
| download | ocaml-432bb22c1aa26a4329f1732d2e22761ef322476f.tar.gz | |
camlp4: initial support for polymorphic recursion
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@10404 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
| -rw-r--r-- | camlp4/Camlp4Parsers/Camlp4OCamlRevisedParser.ml | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/camlp4/Camlp4Parsers/Camlp4OCamlRevisedParser.ml b/camlp4/Camlp4Parsers/Camlp4OCamlRevisedParser.ml index 81e252cfe1..7cc39371de 100644 --- a/camlp4/Camlp4Parsers/Camlp4OCamlRevisedParser.ml +++ b/camlp4/Camlp4Parsers/Camlp4OCamlRevisedParser.ml @@ -791,9 +791,8 @@ Very old (no more supported) syntax:\n\ [ RIGHTA [ p = labeled_ipatt; e = SELF -> <:expr< fun $p$ -> $e$ >> - | "="; e = expr -> <:expr< $e$ >> - | ":"; t = ctyp; "="; e = expr -> <:expr< ($e$ : $t$) >> - | ":>"; t = ctyp; "="; e = expr -> <:expr< ($e$ :> $t$) >> ] ] + | bi = cvalue_binding -> bi + ] ] ; match_case: [ [ "["; l = LIST0 match_case0 SEP "|"; "]" -> Ast.mcOr_of_list l @@ -1325,9 +1324,11 @@ Very old (no more supported) syntax:\n\ ; cvalue_binding: [ [ "="; e = expr -> e - | ":"; t = ctyp; "="; e = expr -> <:expr< ($e$ : $t$) >> - | ":"; t = ctyp; ":>"; t2 = ctyp; "="; e = expr -> - <:expr< ($e$ : $t$ :> $t2$) >> + | ":"; t = poly_type; "="; e = expr -> <:expr< ($e$ : $t$) >> + | ":"; t = poly_type; ":>"; t2 = ctyp; "="; e = expr -> + match t with + [ <:ctyp< ! $_$ . $_$ >> -> raise (Stream.Error "unexpected polytype here") + | _ -> <:expr< ($e$ : $t$ :> $t2$) >> ] | ":>"; t = ctyp; "="; e = expr -> <:expr< ($e$ :> $t$) >> ] ] ; label: |
