summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlain Frisch <alain@frisch.fr>2009-10-20 07:06:43 (GMT)
committerAlain Frisch <alain@frisch.fr>2009-10-20 07:06:43 (GMT)
commit09cb552e178f1468e6736b2f262a057923e3a964 (patch)
tree1d503d59954d340d51400266754b5539c5bfdb9f
parent835ae86ff12308d2fb2da222d092bd5b458d5007 (diff)
downloadocaml-09cb552e178f1468e6736b2f262a057923e3a964.zip
ocaml-09cb552e178f1468e6736b2f262a057923e3a964.tar.gz
ocaml-09cb552e178f1468e6736b2f262a057923e3a964.tar.bz2
Import changes from the newtypein branch (svn merge -r 9367:9381 https://yquem.inria.fr/caml/svn/ocaml/branches/newtypein).
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@9382 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r--parsing/parser.mly8
1 files changed, 6 insertions, 2 deletions
diff --git a/parsing/parser.mly b/parsing/parser.mly
index 867db06..761b5a9 100644
--- a/parsing/parser.mly
+++ b/parsing/parser.mly
@@ -825,12 +825,12 @@ expr:
{ mkexp(Pexp_let($2, List.rev $3, $5)) }
| LET MODULE UIDENT module_binding IN seq_expr
{ mkexp(Pexp_letmodule($3, $4, $6)) }
- | LET NEW TYPE LIDENT IN seq_expr
- { mkexp(Pexp_newtype($4, $6)) }
| FUNCTION opt_bar match_cases
{ mkexp(Pexp_function("", None, List.rev $3)) }
| FUN labeled_simple_pattern fun_def
{ let (l,o,p) = $2 in mkexp(Pexp_function(l, o, [p, $3])) }
+ | FUN LPAREN TYPE LIDENT RPAREN fun_def
+ { mkexp(Pexp_newtype($4, $6)) }
| MATCH seq_expr WITH opt_bar match_cases
{ mkexp(Pexp_match($2, List.rev $5)) }
| TRY seq_expr WITH opt_bar match_cases
@@ -1026,6 +1026,8 @@ strict_binding:
{ $2 }
| labeled_simple_pattern fun_binding
{ let (l, o, p) = $1 in ghexp(Pexp_function(l, o, [p, $2])) }
+ | LPAREN TYPE LIDENT RPAREN fun_binding
+ { mkexp(Pexp_newtype($3, $5)) }
;
match_cases:
pattern match_action { [$1, $2] }
@@ -1035,6 +1037,8 @@ fun_def:
match_action { $1 }
| labeled_simple_pattern fun_def
{ let (l,o,p) = $1 in ghexp(Pexp_function(l, o, [p, $2])) }
+ | LPAREN TYPE LIDENT RPAREN fun_def
+ { mkexp(Pexp_newtype($3, $5)) }
;
match_action:
MINUSGREATER seq_expr { $2 }