summaryrefslogtreecommitdiffstats
path: root/parsing/parser.mly
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>2003-06-19 15:53:53 +0000
committerXavier Leroy <xavier.leroy@inria.fr>2003-06-19 15:53:53 +0000
commit1fa763e0c58fa76de0bfaf879f7fdd63ca99f0ec (patch)
treeb5b6ccb30ef36b441b794d55c74841533e1a5c11 /parsing/parser.mly
parentb55c04a78864716f083b03fcdacddd2939e81d6e (diff)
Merge branch with recursive modules
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@5602 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'parsing/parser.mly')
-rw-r--r--parsing/parser.mly21
1 files changed, 20 insertions, 1 deletions
diff --git a/parsing/parser.mly b/parsing/parser.mly
index 574112f1d..6f673e9e8 100644
--- a/parsing/parser.mly
+++ b/parsing/parser.mly
@@ -326,7 +326,8 @@ The precedences must be listed from low to high.
%nonassoc IN
%nonassoc below_SEMI
%nonassoc SEMI /* below EQUAL ({lbl=...; lbl=...}) */
-%nonassoc LET /* above SEMI ( ...; let ... in ...) */
+%nonassoc LET AND /* above SEMI ( ...; let ... in ...) */
+ /* below WITH (module rec A: SIG with ... and ...) */
%nonassoc below_WITH
%nonassoc FUNCTION WITH /* below BAR (match ... with ...) */
%nonassoc THEN /* below ELSE (if ... then ...) */
@@ -455,6 +456,8 @@ structure_item:
{ mkstr(Pstr_exn_rebind($2, $4)) }
| MODULE UIDENT module_binding
{ mkstr(Pstr_module($2, $3)) }
+ | MODULE REC module_rec_bindings
+ { mkstr(Pstr_recmodule(List.rev $3)) }
| MODULE TYPE ident EQUAL module_type
{ mkstr(Pstr_modtype($3, $5)) }
| OPEN mod_longident
@@ -474,6 +477,13 @@ module_binding:
| LPAREN UIDENT COLON module_type RPAREN module_binding
{ mkmod(Pmod_functor($2, $4, $6)) }
;
+module_rec_bindings:
+ module_rec_binding { [$1] }
+ | module_rec_bindings AND module_rec_binding { $3 :: $1 }
+;
+module_rec_binding:
+ UIDENT COLON module_type EQUAL module_expr { ($1, $3, $5) }
+;
/* Module types */
@@ -510,6 +520,8 @@ signature_item:
{ mksig(Psig_exception($2, $3)) }
| MODULE UIDENT module_declaration
{ mksig(Psig_module($2, $3)) }
+ | MODULE REC module_rec_declarations
+ { mksig(Psig_recmodule(List.rev $3)) }
| MODULE TYPE ident
{ mksig(Psig_modtype($3, Pmodtype_abstract)) }
| MODULE TYPE ident EQUAL module_type
@@ -530,6 +542,13 @@ module_declaration:
| LPAREN UIDENT COLON module_type RPAREN module_declaration
{ mkmty(Pmty_functor($2, $4, $6)) }
;
+module_rec_declarations:
+ module_rec_declaration { [$1] }
+ | module_rec_declarations AND module_rec_declaration { $3 :: $1 }
+;
+module_rec_declaration:
+ UIDENT COLON module_type { ($1, $3) }
+;
/* Class expressions */