summaryrefslogtreecommitdiffstats
path: root/parsing/parser.mly
diff options
context:
space:
mode:
authorJacques Garrigue <garrigue at math.nagoya-u.ac.jp>2013-12-17 03:52:50 +0000
committerJacques Garrigue <garrigue at math.nagoya-u.ac.jp>2013-12-17 03:52:50 +0000
commitcfa350c31aebe2e06611d0fbb41fe88b1f30b8e8 (patch)
tree9809a9c320538a793866f1ca7a408fe09679a902 /parsing/parser.mly
parent024c8ad498a7c0fc35355c543d94a14bfd3fab51 (diff)
merge generative functors
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14365 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'parsing/parser.mly')
-rw-r--r--parsing/parser.mly19
1 files changed, 15 insertions, 4 deletions
diff --git a/parsing/parser.mly b/parsing/parser.mly
index f08afc21d..7f23730f3 100644
--- a/parsing/parser.mly
+++ b/parsing/parser.mly
@@ -541,9 +541,13 @@ module_expr:
| STRUCT structure error
{ unclosed "struct" 1 "end" 3 }
| FUNCTOR LPAREN UIDENT COLON module_type RPAREN MINUSGREATER module_expr
- { mkmod(Pmod_functor(mkrhs $3 3, $5, $8)) }
+ { mkmod(Pmod_functor(mkrhs $3 3, Some $5, $8)) }
+ | FUNCTOR LPAREN RPAREN MINUSGREATER module_expr
+ { mkmod(Pmod_functor(mkrhs "()" 3, None, $5)) }
| module_expr LPAREN module_expr RPAREN
{ mkmod(Pmod_apply($1, $3)) }
+ | module_expr LPAREN RPAREN
+ { mkmod(Pmod_apply($1, mkmod (Pmod_structure []))) }
| module_expr LPAREN module_expr error
{ unclosed "(" 2 ")" 4 }
| LPAREN module_expr COLON module_type RPAREN
@@ -640,7 +644,9 @@ module_binding_body:
| COLON module_type EQUAL module_expr
{ mkmod(Pmod_constraint($4, $2)) }
| LPAREN UIDENT COLON module_type RPAREN module_binding_body
- { mkmod(Pmod_functor(mkrhs $2 2, $4, $6)) }
+ { mkmod(Pmod_functor(mkrhs $2 2, Some $4, $6)) }
+ | LPAREN RPAREN module_binding_body
+ { mkmod(Pmod_functor(mkrhs "()" 1, None, $3)) }
;
module_bindings:
module_binding { [$1] }
@@ -662,7 +668,10 @@ module_type:
{ unclosed "sig" 1 "end" 3 }
| FUNCTOR LPAREN UIDENT COLON module_type RPAREN MINUSGREATER module_type
%prec below_WITH
- { mkmty(Pmty_functor(mkrhs $3 3, $5, $8)) }
+ { mkmty(Pmty_functor(mkrhs $3 3, Some $5, $8)) }
+ | FUNCTOR LPAREN RPAREN MINUSGREATER module_type
+ %prec below_WITH
+ { mkmty(Pmty_functor(mkrhs "()" 2, None, $5)) }
| module_type WITH with_constraints
{ mkmty(Pmty_with($1, List.rev $3)) }
| MODULE TYPE OF module_expr %prec below_LBRACKETAT
@@ -724,7 +733,9 @@ module_declaration:
COLON module_type
{ $2 }
| LPAREN UIDENT COLON module_type RPAREN module_declaration
- { mkmty(Pmty_functor(mkrhs $2 2, $4, $6)) }
+ { mkmty(Pmty_functor(mkrhs $2 2, Some $4, $6)) }
+ | LPAREN RPAREN module_declaration
+ { mkmty(Pmty_functor(mkrhs "()" 1, None, $3)) }
;
module_rec_declarations:
module_rec_declaration { [$1] }