summaryrefslogtreecommitdiffstats
path: root/camlp4
diff options
context:
space:
mode:
authorDaniel de Rauglaudre <daniel.de_rauglaudre@inria.fr>2002-01-24 17:10:02 +0000
committerDaniel de Rauglaudre <daniel.de_rauglaudre@inria.fr>2002-01-24 17:10:02 +0000
commit6cfa882208d6933deba30173dddf313b7416c504 (patch)
tree6f55d9660832963d37b7450b8baa954c2eb2aeb2 /camlp4
parent5827cbc88ea41170aa5dcf64576ebc81a988824e (diff)
-
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@4308 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'camlp4')
-rw-r--r--camlp4/meta/pa_r.ml53
-rw-r--r--camlp4/meta/q_MLast.ml72
-rw-r--r--camlp4/ocaml_src/meta/pa_r.ml167
-rw-r--r--camlp4/ocaml_src/meta/q_MLast.ml315
4 files changed, 323 insertions, 284 deletions
diff --git a/camlp4/meta/pa_r.ml b/camlp4/meta/pa_r.ml
index a02fdb975..acb72ab83 100644
--- a/camlp4/meta/pa_r.ml
+++ b/camlp4/meta/pa_r.ml
@@ -242,8 +242,8 @@ EXTEND
| "open"; i = mod_ident -> <:str_item< open $i$ >>
| "type"; tdl = LIST1 type_declaration SEP "and" ->
<:str_item< type $list:tdl$ >>
- | "value"; r = OPT "rec"; l = LIST1 let_binding SEP "and" ->
- <:str_item< value $rec:o2b r$ $list:l$ >>
+ | "value"; r = rec_flag; l = LIST1 let_binding SEP "and" ->
+ <:str_item< value $rec:r$ $list:l$ >>
| e = expr -> <:str_item< $exp:e$ >> ] ]
;
rebind_exn:
@@ -305,9 +305,9 @@ EXTEND
;
expr:
[ "top" RIGHTA
- [ "let"; r = OPT "rec"; l = LIST1 let_binding SEP "and"; "in";
+ [ "let"; r = rec_flag; l = LIST1 let_binding SEP "and"; "in";
x = SELF ->
- <:expr< let $rec:o2b r$ $list:l$ in $x$ >>
+ <:expr< let $rec:r$ $list:l$ in $x$ >>
| "let"; "module"; m = UIDENT; mb = module_binding; "in"; e = SELF ->
<:expr< let module $m$ = $mb$ in $e$ >>
| "fun"; "["; l = LIST0 match_case SEP "|"; "]" ->
@@ -330,8 +330,8 @@ EXTEND
| "while"; e = SELF; "do"; "{"; seq = sequence; "}" ->
<:expr< while $e$ do { $list:seq$ } >> ]
| "where"
- [ e = SELF; "where"; rf = OPT "rec"; lb = let_binding ->
- <:expr< let $rec:o2b rf$ $list:[lb]$ in $e$ >> ]
+ [ e = SELF; "where"; rf = rec_flag; lb = let_binding ->
+ <:expr< let $rec:rf$ $list:[lb]$ in $e$ >> ]
| ":=" NONA
[ e1 = SELF; ":="; e2 = SELF; dummy -> <:expr< $e1$ := $e2$ >> ]
| "||" RIGHTA
@@ -390,8 +390,7 @@ EXTEND
| s = CHAR -> <:expr< $chr:s$ >>
| i = expr_ident -> i
| "["; "]" -> <:expr< [] >>
- | "["; el = LIST1 expr SEP ";"; last = OPT [ "::"; e = expr -> e ];
- "]" ->
+ | "["; el = LIST1 expr SEP ";"; last = cons_expr_opt; "]" ->
mklistexp loc last el
| "[|"; el = LIST0 expr SEP ";"; "|]" -> <:expr< [| $list:el$ |] >>
| "{"; lel = LIST1 label_expr SEP ";"; "}" -> <:expr< { $list:lel$ } >>
@@ -404,13 +403,17 @@ EXTEND
<:expr< ( $list:[e::el]$) >>
| "("; e = SELF; ")" -> <:expr< $e$ >> ] ]
;
+ cons_expr_opt:
+ [ [ "::"; e = expr -> Some e
+ | -> None ] ]
+ ;
dummy:
[ [ -> () ] ]
;
sequence:
- [ [ "let"; o = OPT "rec"; l = LIST1 let_binding SEP "and"; [ "in" | ";" ];
+ [ [ "let"; rf = rec_flag; l = LIST1 let_binding SEP "and"; [ "in" | ";" ];
el = SELF ->
- [ <:expr< let $rec:o2b o$ $list:l$ in $mksequence loc el$ >>]
+ [ <:expr< let $rec:rf$ $list:l$ in $mksequence loc el$ >>]
| e = expr; ";"; el = SELF -> [e :: el]
| e = expr; ";" -> [e]
| e = expr -> [e] ] ]
@@ -425,10 +428,17 @@ EXTEND
| ":"; t = ctyp; "="; e = expr -> <:expr< ($e$ : $t$) >> ] ]
;
match_case:
- [ [ p = patt; aso = OPT [ "as"; p = patt -> p ];
- w = OPT [ "when"; e = expr -> e ]; "->"; e = expr ->
+ [ [ p = patt; aso = as_patt_opt; w = when_expr_opt; "->"; e = expr ->
mkmatchcase loc p aso w e ] ]
;
+ as_patt_opt:
+ [ [ "as"; p = patt -> Some p
+ | -> None ] ]
+ ;
+ when_expr_opt:
+ [ [ "when"; e = expr -> Some e
+ | -> None ] ]
+ ;
label_expr:
[ [ i = patt_label_ident; e = fun_binding -> (i, e) ] ]
;
@@ -462,8 +472,7 @@ EXTEND
| "-"; s = INT -> mkuminpat loc "-" True s
| "-"; s = FLOAT -> mkuminpat loc "-" False s
| "["; "]" -> <:patt< [] >>
- | "["; pl = LIST1 patt SEP ";"; last = OPT [ "::"; p = patt -> p ];
- "]" ->
+ | "["; pl = LIST1 patt SEP ";"; last = cons_patt_opt; "]" ->
mklistpat loc last pl
| "[|"; pl = LIST0 patt SEP ";"; "|]" -> <:patt< [| $list:pl$ |] >>
| "{"; lpl = LIST1 label_patt SEP ";"; "}" -> <:patt< { $list:lpl$ } >>
@@ -475,6 +484,10 @@ EXTEND
<:patt< ( $list:[p::pl]$) >>
| "_" -> <:patt< _ >> ] ]
;
+ cons_patt_opt:
+ [ [ "::"; p = patt -> Some p
+ | -> None ] ]
+ ;
label_patt:
[ [ i = patt_label_ident; "="; p = patt -> (i, p) ] ]
;
@@ -544,8 +557,8 @@ EXTEND
| ci = UIDENT -> (loc, ci, []) ] ]
;
label_declaration:
- [ [ i = LIDENT; ":"; mf = OPT "mutable"; t = ctyp ->
- (loc, i, o2b mf, t) ] ]
+ [ [ i = LIDENT; ":"; mf = mutable_flag; t = ctyp ->
+ (loc, i, mf, t) ] ]
;
ident:
[ [ i = LIDENT -> i
@@ -557,10 +570,18 @@ EXTEND
| i = LIDENT -> [i]
| i = UIDENT; "."; j = SELF -> [i :: j] ] ]
;
+ rec_flag:
+ [ [ "rec" -> True
+ | -> False ] ]
+ ;
direction_flag:
[ [ "to" -> True
| "downto" -> False ] ]
;
+ mutable_flag:
+ [ [ "mutable" -> True
+ | -> False ] ]
+ ;
END;
EXTEND
diff --git a/camlp4/meta/q_MLast.ml b/camlp4/meta/q_MLast.ml
index 3c2cb6515..edd702330 100644
--- a/camlp4/meta/q_MLast.ml
+++ b/camlp4/meta/q_MLast.ml
@@ -197,8 +197,8 @@ EXTEND
| "open"; i = mod_ident -> Node "StOpn" [Loc; i]
| "type"; tdl = SLIST1 type_declaration SEP "and" ->
Node "StTyp" [Loc; tdl]
- | "value"; r = SOPT "rec"; l = SLIST1 let_binding SEP "and" ->
- Node "StVal" [Loc; o2b r; l]
+ | "value"; r = rec_flag; l = SLIST1 let_binding SEP "and" ->
+ Node "StVal" [Loc; r; l]
| e = expr -> Node "StExp" [Loc; e] ] ]
;
rebind_exn:
@@ -264,9 +264,9 @@ EXTEND
;
expr:
[ "top" RIGHTA
- [ "let"; r = SOPT "rec"; l = SLIST1 let_binding SEP "and"; "in";
+ [ "let"; r = rec_flag; l = SLIST1 let_binding SEP "and"; "in";
x = SELF ->
- Node "ExLet" [Loc; o2b r; l; x]
+ Node "ExLet" [Loc; r; l; x]
| "let"; "module"; m = a_UIDENT; mb = module_binding; "in"; e = SELF ->
Node "ExLmd" [Loc; m; mb; e]
| "fun"; "["; l = SLIST0 match_case SEP "|"; "]" ->
@@ -290,8 +290,8 @@ EXTEND
| "while"; e = SELF; "do"; "{"; seq = sequence; "}" ->
Node "ExWhi" [Loc; e; seq] ]
| "where"
- [ e = SELF; "where"; rf = SOPT "rec"; lb = let_binding ->
- Node "ExLet" [Loc; o2b rf; List [lb]; e] ]
+ [ e = SELF; "where"; rf = rec_flag; lb = let_binding ->
+ Node "ExLet" [Loc; rf; List [lb]; e] ]
| ":=" NONA
[ e1 = SELF; ":="; e2 = SELF; dummy -> Node "ExAss" [Loc; e1; e2] ]
| "||" RIGHTA
@@ -407,8 +407,7 @@ EXTEND
| s = a_CHAR -> Node "ExChr" [Loc; s]
| i = expr_ident -> i
| "["; "]" -> Node "ExUid" [Loc; Str "[]"]
- | "["; el = SLIST1 expr SEP ";"; last = SOPT [ "::"; e = expr -> e ];
- "]" ->
+ | "["; el = SLIST1 expr SEP ";"; last = cons_expr_opt; "]" ->
mklistexp loc last el
| "[|"; el = SLIST0 expr SEP ";"; "|]" -> Node "ExArr" [Loc; el]
| "{"; lel = SLIST1 label_expr SEP ";"; "}" ->
@@ -422,13 +421,17 @@ EXTEND
Node "ExTup" [Loc; Cons e el]
| "("; e = SELF; ")" -> e ] ]
;
+ cons_expr_opt:
+ [ [ "::"; e = expr -> Option (Some e)
+ | -> Option None ] ]
+ ;
dummy:
[ [ -> () ] ]
;
sequence:
- [ [ "let"; o = SOPT "rec"; l = SLIST1 let_binding SEP "and";
+ [ [ "let"; rf = rec_flag; l = SLIST1 let_binding SEP "and";
[ "in" | ";" ]; el = SELF ->
- List [Node "ExLet" [Loc; o2b o; l; mksequence loc el]]
+ List [Node "ExLet" [Loc; rf; l; mksequence loc el]]
| e = expr; ";"; el = SELF -> Cons e el
| e = expr; ";" -> List [e]
| e = expr -> List [e] ] ]
@@ -444,10 +447,17 @@ EXTEND
| ":"; t = ctyp; "="; e = expr -> Node "ExTyc" [Loc; e; t] ] ]
;
match_case:
- [ [ p = patt; aso = SOPT [ "as"; p = patt -> p ];
- w = SOPT [ "when"; e = expr -> e ]; "->"; e = expr ->
+ [ [ p = patt; aso = as_patt_opt; w = when_expr_opt; "->"; e = expr ->
mkmatchcase loc p aso w e ] ]
;
+ as_patt_opt:
+ [ [ "as"; p = patt -> Option (Some p)
+ | -> Option None ] ]
+ ;
+ when_expr_opt:
+ [ [ "when"; e = expr -> Option (Some e)
+ | -> Option None ] ]
+ ;
label_expr:
[ [ i = patt_label_ident; e = fun_binding -> Tuple [i; e] ] ]
;
@@ -482,8 +492,7 @@ EXTEND
| "-"; s = a_INT -> mkuminpat loc "-" True s
| "-"; s = a_FLOAT -> mkuminpat loc "-" False s
| "["; "]" -> Node "PaUid" [Loc; Str "[]"]
- | "["; pl = SLIST1 patt SEP ";"; last = SOPT [ "::"; p = patt -> p ];
- "]" ->
+ | "["; pl = SLIST1 patt SEP ";"; last = cons_patt_opt; "]" ->
mklistpat loc last pl
| "[|"; pl = SLIST0 patt SEP ";"; "|]" -> Node "PaArr" [Loc; pl]
| "{"; lpl = SLIST1 label_patt SEP ";"; "}" -> Node "PaRec" [Loc; lpl]
@@ -495,6 +504,10 @@ EXTEND
Node "PaTup" [Loc; Cons p pl]
| "_" -> Node "PaAny" [Loc] ] ]
;
+ cons_patt_opt:
+ [ [ "::"; p = patt -> Option (Some p)
+ | -> Option None ] ]
+ ;
label_patt:
[ [ i = patt_label_ident; "="; p = patt -> Tuple [i; p] ] ]
;
@@ -574,16 +587,22 @@ EXTEND
;
mod_ident:
[ RIGHTA
- [ a = a_mod_ident -> a
- | i = a_UIDENT -> List [i]
+ [ i = a_UIDENT -> List [i]
| i = a_LIDENT -> List [i]
| i = a_UIDENT; "."; j = SELF -> Cons i j ] ]
;
+ rec_flag:
+ [ [ "rec" -> Bool True
+ | -> Bool False ] ]
+ ;
direction_flag:
- [ [ a = a_direction_flag -> a
- | "to" -> Bool True
+ [ [ "to" -> Bool True
| "downto" -> Bool False ] ]
;
+ mutable_flag:
+ [ [ "mutable" -> Bool True
+ | -> Bool False ] ]
+ ;
(* Objects and Classes *)
str_item:
[ [ "class"; cd = SLIST1 class_declaration SEP "and" ->
@@ -834,14 +853,12 @@ EXTEND
[ [ "`"; s = ident -> Node "ExVrn" [Loc; s] ] ]
;
- mutable_flag:
- [ [ a = anti_mut -> a
- | "mutable" -> Bool True
- | -> Bool False ] ]
- ;
str_item:
[ [ "#"; n = a_LIDENT; dp = dir_param -> Node "StDir" [Loc; n; dp] ] ]
;
+ rec_flag:
+ [ [ a = ANTIQUOT "rec" -> antiquot "rec" loc a ] ]
+ ;
sig_item:
[ [ "#"; n = a_LIDENT; dp = dir_param -> Node "SgDir" [Loc; n; dp] ] ]
;
@@ -887,6 +904,9 @@ EXTEND
patt_label_ident: LEVEL "simple"
[ [ a = ANTIQUOT -> antiquot "" loc a ] ]
;
+ when_expr_opt:
+ [ [ a = ANTIQUOT "when" -> antiquot "when" loc a ] ]
+ ;
ipatt:
[ [ a = ANTIQUOT "pat" -> antiquot "pat" loc a
| a = ANTIQUOT "" -> antiquot "" loc a
@@ -898,10 +918,10 @@ EXTEND
| a = ANTIQUOT "" -> antiquot "" loc a
| "("; tl = anti_list; ")" -> Node "TyTup" [Loc; tl] ] ]
;
- a_mod_ident:
+ mod_ident:
[ [ a = ANTIQUOT -> antiquot "" loc a ] ]
;
- a_direction_flag:
+ direction_flag:
[ [ a = ANTIQUOT "to" -> antiquot "to" loc a ] ]
;
a_class_str_item:
@@ -949,7 +969,7 @@ EXTEND
anti_list:
[ [ a = ANTIQUOT "list" -> antiquot "list" loc a ] ]
;
- anti_mut:
+ mutable_flag:
[ [ a = ANTIQUOT "mut" -> antiquot "mut" loc a ] ]
;
anti_opt:
diff --git a/camlp4/ocaml_src/meta/pa_r.ml b/camlp4/ocaml_src/meta/pa_r.ml
index 980f0f786..756ff50db 100644
--- a/camlp4/ocaml_src/meta/pa_r.ml
+++ b/camlp4/ocaml_src/meta/pa_r.ml
@@ -305,15 +305,23 @@ Grammar.extend
grammar_entry_create "module_declaration"
and with_constr : 'with_constr Grammar.Entry.e =
grammar_entry_create "with_constr"
+ and cons_expr_opt : 'cons_expr_opt Grammar.Entry.e =
+ grammar_entry_create "cons_expr_opt"
and dummy : 'dummy Grammar.Entry.e = grammar_entry_create "dummy"
and sequence : 'sequence Grammar.Entry.e = grammar_entry_create "sequence"
and match_case : 'match_case Grammar.Entry.e =
grammar_entry_create "match_case"
+ and as_patt_opt : 'as_patt_opt Grammar.Entry.e =
+ grammar_entry_create "as_patt_opt"
+ and when_expr_opt : 'when_expr_opt Grammar.Entry.e =
+ grammar_entry_create "when_expr_opt"
and label_expr : 'label_expr Grammar.Entry.e =
grammar_entry_create "label_expr"
and expr_ident : 'expr_ident Grammar.Entry.e =
grammar_entry_create "expr_ident"
and fun_def : 'fun_def Grammar.Entry.e = grammar_entry_create "fun_def"
+ and cons_patt_opt : 'cons_patt_opt Grammar.Entry.e =
+ grammar_entry_create "cons_patt_opt"
and label_patt : 'label_patt Grammar.Entry.e =
grammar_entry_create "label_patt"
and patt_label_ident : 'patt_label_ident Grammar.Entry.e =
@@ -330,7 +338,11 @@ Grammar.extend
grammar_entry_create "constructor_declaration"
and label_declaration : 'label_declaration Grammar.Entry.e =
grammar_entry_create "label_declaration"
- and ident : 'ident Grammar.Entry.e = grammar_entry_create "ident" in
+ and ident : 'ident Grammar.Entry.e = grammar_entry_create "ident"
+ and rec_flag : 'rec_flag Grammar.Entry.e = grammar_entry_create "rec_flag"
+ and mutable_flag : 'mutable_flag Grammar.Entry.e =
+ grammar_entry_create "mutable_flag"
+ in
[Grammar.Entry.obj (module_expr : 'module_expr Grammar.Entry.e), None,
[None, None,
[[Gramext.Stoken ("", "struct");
@@ -388,15 +400,15 @@ Grammar.extend
(fun (e : 'expr) (loc : int * int) ->
(MLast.StExp (loc, e) : 'str_item));
[Gramext.Stoken ("", "value");
- Gramext.Sopt (Gramext.Stoken ("", "rec"));
+ Gramext.Snterm
+ (Grammar.Entry.obj (rec_flag : 'rec_flag Grammar.Entry.e));
Gramext.Slist1sep
(Gramext.Snterm
(Grammar.Entry.obj (let_binding : 'let_binding Grammar.Entry.e)),
Gramext.Stoken ("", "and"))],
Gramext.action
- (fun (l : 'let_binding list) (r : string option) _
- (loc : int * int) ->
- (MLast.StVal (loc, o2b r, l) : 'str_item));
+ (fun (l : 'let_binding list) (r : 'rec_flag) _ (loc : int * int) ->
+ (MLast.StVal (loc, r, l) : 'str_item));
[Gramext.Stoken ("", "type");
Gramext.Slist1sep
(Gramext.Snterm
@@ -763,25 +775,28 @@ Grammar.extend
(fun (e : 'expr) _ (mb : 'module_binding) (m : string) _ _
(loc : int * int) ->
(MLast.ExLmd (loc, m, mb, e) : 'expr));
- [Gramext.Stoken ("", "let"); Gramext.Sopt (Gramext.Stoken ("", "rec"));
+ [Gramext.Stoken ("", "let");
+ Gramext.Snterm
+ (Grammar.Entry.obj (rec_flag : 'rec_flag Grammar.Entry.e));
Gramext.Slist1sep
(Gramext.Snterm
(Grammar.Entry.obj (let_binding : 'let_binding Grammar.Entry.e)),
Gramext.Stoken ("", "and"));
Gramext.Stoken ("", "in"); Gramext.Sself],
Gramext.action
- (fun (x : 'expr) _ (l : 'let_binding list) (r : string option) _
+ (fun (x : 'expr) _ (l : 'let_binding list) (r : 'rec_flag) _
(loc : int * int) ->
- (MLast.ExLet (loc, o2b r, l, x) : 'expr))];
+ (MLast.ExLet (loc, r, l, x) : 'expr))];
Some "where", None,
[[Gramext.Sself; Gramext.Stoken ("", "where");
- Gramext.Sopt (Gramext.Stoken ("", "rec"));
+ Gramext.Snterm
+ (Grammar.Entry.obj (rec_flag : 'rec_flag Grammar.Entry.e));
Gramext.Snterm
(Grammar.Entry.obj (let_binding : 'let_binding Grammar.Entry.e))],
Gramext.action
- (fun (lb : 'let_binding) (rf : string option) _ (e : 'expr)
+ (fun (lb : 'let_binding) (rf : 'rec_flag) _ (e : 'expr)
(loc : int * int) ->
- (MLast.ExLet (loc, o2b rf, [lb], e) : 'expr))];
+ (MLast.ExLet (loc, rf, [lb], e) : 'expr))];
Some ":=", Some Gramext.NonA,
[[Gramext.Sself; Gramext.Stoken ("", ":="); Gramext.Sself;
Gramext.Snterm (Grammar.Entry.obj (dummy : 'dummy Grammar.Entry.e))],
@@ -1058,16 +1073,12 @@ Grammar.extend
Gramext.Slist1sep
(Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e)),
Gramext.Stoken ("", ";"));
- Gramext.Sopt
- (Gramext.srules
- [[Gramext.Stoken ("", "::");
- Gramext.Snterm
- (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))],
- Gramext.action
- (fun (e : 'expr) _ (loc : int * int) -> (e : 'e__5))]);
+ Gramext.Snterm
+ (Grammar.Entry.obj (cons_expr_opt : 'cons_expr_opt Grammar.Entry.e));
Gramext.Stoken ("", "]")],
Gramext.action
- (fun _ (last : 'e__5 option) (el : 'expr list) _ (loc : int * int) ->
+ (fun _ (last : 'cons_expr_opt) (el : 'expr list) _
+ (loc : int * int) ->
(mklistexp loc last el : 'expr));
[Gramext.Stoken ("", "["); Gramext.Stoken ("", "]")],
Gramext.action
@@ -1091,6 +1102,13 @@ Grammar.extend
Gramext.action
(fun (s : string) (loc : int * int) ->
(MLast.ExInt (loc, s) : 'expr))]];
+ Grammar.Entry.obj (cons_expr_opt : 'cons_expr_opt Grammar.Entry.e), None,
+ [None, None,
+ [[], Gramext.action (fun (loc : int * int) -> (None : 'cons_expr_opt));
+ [Gramext.Stoken ("", "::");
+ Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))],
+ Gramext.action
+ (fun (e : 'expr) _ (loc : int * int) -> (Some e : 'cons_expr_opt))]];
Grammar.Entry.obj (dummy : 'dummy Grammar.Entry.e), None,
[None, None,
[[], Gramext.action (fun (loc : int * int) -> (() : 'dummy))]];
@@ -1107,21 +1125,23 @@ Grammar.extend
Gramext.action
(fun (el : 'sequence) _ (e : 'expr) (loc : int * int) ->
(e :: el : 'sequence));
- [Gramext.Stoken ("", "let"); Gramext.Sopt (Gramext.Stoken ("", "rec"));
+ [Gramext.Stoken ("", "let");
+ Gramext.Snterm
+ (Grammar.Entry.obj (rec_flag : 'rec_flag Grammar.Entry.e));
Gramext.Slist1sep
(Gramext.Snterm
(Grammar.Entry.obj (let_binding : 'let_binding Grammar.Entry.e)),
Gramext.Stoken ("", "and"));
Gramext.srules
[[Gramext.Stoken ("", ";")],
- Gramext.action (fun (x : string) (loc : int * int) -> (x : 'e__6));
+ Gramext.action (fun (x : string) (loc : int * int) -> (x : 'e__5));
[Gramext.Stoken ("", "in")],
- Gramext.action (fun (x : string) (loc : int * int) -> (x : 'e__6))];
+ Gramext.action (fun (x : string) (loc : int * int) -> (x : 'e__5))];
Gramext.Sself],
Gramext.action
- (fun (el : 'sequence) _ (l : 'let_binding list) (o : string option) _
+ (fun (el : 'sequence) _ (l : 'let_binding list) (rf : 'rec_flag) _
(loc : int * int) ->
- ([MLast.ExLet (loc, o2b o, l, mksequence loc el)] : 'sequence))]];
+ ([MLast.ExLet (loc, rf, l, mksequence loc el)] : 'sequence))]];
Grammar.Entry.obj (let_binding : 'let_binding Grammar.Entry.e), None,
[None, None,
[[Gramext.Snterm (Grammar.Entry.obj (ipatt : 'ipatt Grammar.Entry.e));
@@ -1151,26 +1171,30 @@ Grammar.extend
Grammar.Entry.obj (match_case : 'match_case Grammar.Entry.e), None,
[None, None,
[[Gramext.Snterm (Grammar.Entry.obj (patt : 'patt Grammar.Entry.e));
- Gramext.Sopt
- (Gramext.srules
- [[Gramext.Stoken ("", "as");
- Gramext.Snterm
- (Grammar.Entry.obj (patt : 'patt Grammar.Entry.e))],
- Gramext.action
- (fun (p : 'patt) _ (loc : int * int) -> (p : 'e__7))]);
- Gramext.Sopt
- (Gramext.srules
- [[Gramext.Stoken ("", "when");
- Gramext.Snterm
- (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))],
- Gramext.action
- (fun (e : 'expr) _ (loc : int * int) -> (e : 'e__8))]);
+ Gramext.Snterm
+ (Grammar.Entry.obj (as_patt_opt : 'as_patt_opt Grammar.Entry.e));
+ Gramext.Snterm
+ (Grammar.Entry.obj (when_expr_opt : 'when_expr_opt Grammar.Entry.e));
Gramext.Stoken ("", "->");
Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))],
Gramext.action
- (fun (e : 'expr) _ (w : 'e__8 option) (aso : 'e__7 option) (p : 'patt)
- (loc : int * int) ->
+ (fun (e : 'expr) _ (w : 'when_expr_opt) (aso : 'as_patt_opt)
+ (p : 'patt) (loc : int * int) ->
(mkmatchcase loc p aso w e : 'match_case))]];
+ Grammar.Entry.obj (as_patt_opt : 'as_patt_opt Grammar.Entry.e), None,
+ [None, None,
+ [[], Gramext.action (fun (loc : int * int) -> (None : 'as_patt_opt));
+ [Gramext.Stoken ("", "as");
+ Gramext.Snterm (Grammar.Entry.obj (patt : 'patt Grammar.Entry.e))],
+ Gramext.action
+ (fun (p : 'patt) _ (loc : int * int) -> (Some p : 'as_patt_opt))]];
+ Grammar.Entry.obj (when_expr_opt : 'when_expr_opt Grammar.Entry.e), None,
+ [None, None,
+ [[], Gramext.action (fun (loc : int * int) -> (None : 'when_expr_opt));
+ [Gramext.Stoken ("", "when");
+ Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))],
+ Gramext.action
+ (fun (e : 'expr) _ (loc : int * int) -> (Some e : 'when_expr_opt))]];
Grammar.Entry.obj (label_expr : 'label_expr Grammar.Entry.e), None,
[None, None,
[[Gramext.Snterm
@@ -1275,16 +1299,12 @@ Grammar.extend
Gramext.Slist1sep
(Gramext.Snterm (Grammar.Entry.obj (patt : 'patt Grammar.Entry.e)),
Gramext.Stoken ("", ";"));
- Gramext.Sopt
- (Gramext.srules
- [[Gramext.Stoken ("", "::");
- Gramext.Snterm
- (Grammar.Entry.obj (patt : 'patt Grammar.Entry.e))],
- Gramext.action
- (fun (p : 'patt) _ (loc : int * int) -> (p : 'e__9))]);
+ Gramext.Snterm
+ (Grammar.Entry.obj (cons_patt_opt : 'cons_patt_opt Grammar.Entry.e));
Gramext.Stoken ("", "]")],
Gramext.action
- (fun _ (last : 'e__9 option) (pl : 'patt list) _ (loc : int * int) ->
+ (fun _ (last : 'cons_patt_opt) (pl : 'patt list) _
+ (loc : int * int) ->
(mklistpat loc last pl : 'patt));
[Gramext.Stoken ("", "["); Gramext.Stoken ("", "]")],
Gramext.action
@@ -1321,6 +1341,13 @@ Grammar.extend
Gramext.action
(fun (s : string) (loc : int * int) ->
(MLast.PaLid (loc, s) : 'patt))]];
+ Grammar.Entry.obj (cons_patt_opt : 'cons_patt_opt Grammar.Entry.e), None,
+ [None, None,
+ [[], Gramext.action (fun (loc : int * int) -> (None : 'cons_patt_opt));
+ [Gramext.Stoken ("", "::");
+ Gramext.Snterm (Grammar.Entry.obj (patt : 'patt Grammar.Entry.e))],
+ Gramext.action
+ (fun (p : 'patt) _ (loc : int * int) -> (Some p : 'cons_patt_opt))]];
Grammar.Entry.obj (label_patt : 'label_patt Grammar.Entry.e), None,
[None, None,
[[Gramext.Snterm
@@ -1542,12 +1569,13 @@ Grammar.extend
None,
[None, None,
[[Gramext.Stoken ("LIDENT", ""); Gramext.Stoken ("", ":");
- Gramext.Sopt (Gramext.Stoken ("", "mutable"));
+ Gramext.Snterm
+ (Grammar.Entry.obj (mutable_flag : 'mutable_flag Grammar.Entry.e));
Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e))],
Gramext.action
- (fun (t : 'ctyp) (mf : string option) _ (i : string)
+ (fun (t : 'ctyp) (mf : 'mutable_flag) _ (i : string)
(loc : int * int) ->
- (loc, i, o2b mf, t : 'label_declaration))]];
+ (loc, i, mf, t : 'label_declaration))]];
Grammar.Entry.obj (ident : 'ident Grammar.Entry.e), None,
[None, None,
[[Gramext.Stoken ("UIDENT", "")],
@@ -1567,14 +1595,23 @@ Grammar.extend
[Gramext.Stoken ("UIDENT", "")],
Gramext.action
(fun (i : string) (loc : int * int) -> ([i] : 'mod_ident))]];
+ Grammar.Entry.obj (rec_flag : 'rec_flag Grammar.Entry.e), None,
+ [None, None,
+ [[], Gramext.action (fun (loc : int * int) -> (false : 'rec_flag));
+ [Gramext.Stoken ("", "rec")],
+ Gramext.action (fun _ (loc : int * int) -> (true : 'rec_flag))]];
Grammar.Entry.obj (direction_flag : 'direction_flag Grammar.Entry.e),
None,
[None, None,
[[Gramext.Stoken ("", "downto")],
Gramext.action (fun _ (loc : int * int) -> (false : 'direction_flag));
[Gramext.Stoken ("", "to")],
- Gramext.action
- (fun _ (loc : int * int) -> (true : 'direction_flag))]]]);;
+ Gramext.action (fun _ (loc : int * int) -> (true : 'direction_flag))]];
+ Grammar.Entry.obj (mutable_flag : 'mutable_flag Grammar.Entry.e), None,
+ [None, None,
+ [[], Gramext.action (fun (loc : int * int) -> (false : 'mutable_flag));
+ [Gramext.Stoken ("", "mutable")],
+ Gramext.action (fun _ (loc : int * int) -> (true : 'mutable_flag))]]]);;
Grammar.extend
[Grammar.Entry.obj (expr : 'expr Grammar.Entry.e),
@@ -1876,9 +1913,9 @@ Grammar.extend
Gramext.Stoken ("", ";")],
Gramext.action
(fun _ (cf : 'class_str_item) (loc : int * int) ->
- (cf : 'e__10))])],
+ (cf : 'e__6))])],
Gramext.action
- (fun (cf : 'e__10 list) (loc : int * int) ->
+ (fun (cf : 'e__6 list) (loc : int * int) ->
(cf : 'class_structure))]];
Grammar.Entry.obj (class_self_patt : 'class_self_patt Grammar.Entry.e),
None,
@@ -1952,9 +1989,9 @@ Grammar.extend
(Gramext.srules
[[Gramext.Stoken ("", "as"); Gramext.Stoken ("LIDENT", "")],
Gramext.action
- (fun (i : string) _ (loc : int * int) -> (i : 'e__11))])],
+ (fun (i : string) _ (loc : int * int) -> (i : 'e__7))])],
Gramext.action
- (fun (pb : 'e__11 option) (ce : 'class_expr) _ (loc : int * int) ->
+ (fun (pb : 'e__7 option) (ce : 'class_expr) _ (loc : int * int) ->
(MLast.CrInh (loc, ce, pb) : 'class_str_item))]];
Grammar.Entry.obj (cvalue : 'cvalue Grammar.Entry.e), None,
[None, None,
@@ -2017,10 +2054,10 @@ Grammar.extend
Gramext.Stoken ("", ";")],
Gramext.action
(fun _ (csf : 'class_sig_item) (loc : int * int) ->
- (csf : 'e__12))]);
+ (csf : 'e__8))]);
Gramext.Stoken ("", "end")],
Gramext.action
- (fun _ (csf : 'e__12 list) (cst : 'class_self_type option) _
+ (fun _ (csf : 'e__8 list) (cst : 'class_self_type option) _
(loc : int * int) ->
(MLast.CtSig (loc, cst, csf) : 'class_type));
[Gramext.Snterm
@@ -2577,10 +2614,10 @@ Grammar.extend
(Grammar.Entry.obj (expr : 'expr Grammar.Entry.e));
Gramext.Stoken ("", ";")],
Gramext.action
- (fun _ (e : 'expr) (loc : int * int) -> (e : 'e__15))]);
+ (fun _ (e : 'expr) (loc : int * int) -> (e : 'e__11))]);
Gramext.Stoken ("", "done")],
Gramext.action
- (fun _ (seq : 'e__15 list) _ (e : 'expr) _ (loc : int * int) ->
+ (fun _ (seq : 'e__11 list) _ (e : 'expr) _ (loc : int * int) ->
(warning_seq (); MLast.ExWhi (loc, e, seq) : 'expr));
[Gramext.Stoken ("", "for"); Gramext.Stoken ("LIDENT", "");
Gramext.Stoken ("", "="); Gramext.Sself;
@@ -2594,10 +2631,10 @@ Grammar.extend
(Grammar.Entry.obj (expr : 'expr Grammar.Entry.e));
Gramext.Stoken ("", ";")],
Gramext.action
- (fun _ (e : 'expr) (loc : int * int) -> (e : 'e__14))]);
+ (fun _ (e : 'expr) (loc : int * int) -> (e : 'e__10))]);
Gramext.Stoken ("", "done")],
Gramext.action
- (fun _ (seq : 'e__14 list) _ (e2 : 'expr) (df : 'direction_flag)
+ (fun _ (seq : 'e__10 list) _ (e2 : 'expr) (df : 'direction_flag)
(e1 : 'expr) _ (i : string) _ (loc : int * int) ->
(warning_seq (); MLast.ExFor (loc, i, e1, e2, df, seq) : 'expr));
[Gramext.Stoken ("", "do");
@@ -2607,8 +2644,8 @@ Grammar.extend
(Grammar.Entry.obj (expr : 'expr Grammar.Entry.e));
Gramext.Stoken ("", ";")],
Gramext.action
- (fun _ (e : 'expr) (loc : int * int) -> (e : 'e__13))]);
+ (fun _ (e : 'expr) (loc : int * int) -> (e : 'e__9))]);
Gramext.Stoken ("", "return"); Gramext.Sself],
Gramext.action
- (fun (e : 'expr) _ (seq : 'e__13 list) _ (loc : int * int) ->
+ (fun (e : 'expr) _ (seq : 'e__9 list) _ (loc : int * int) ->
(warning_seq (); MLast.ExSeq (loc, (seq @ [e])) : 'expr))]]]);;
diff --git a/camlp4/ocaml_src/meta/q_MLast.ml b/camlp4/ocaml_src/meta/q_MLast.ml
index 519fad246..4ab865314 100644
--- a/camlp4/ocaml_src/meta/q_MLast.ml
+++ b/camlp4/ocaml_src/meta/q_MLast.ml
@@ -190,6 +190,8 @@ Grammar.extend
grammar_entry_create "module_declaration"
and with_constr : 'with_constr Grammar.Entry.e =
grammar_entry_create "with_constr"
+ and cons_expr_opt : 'cons_expr_opt Grammar.Entry.e =
+ grammar_entry_create "cons_expr_opt"
and dummy : 'dummy Grammar.Entry.e = grammar_entry_create "dummy"
and let_binding : 'let_binding Grammar.Entry.e =
grammar_entry_create "let_binding"
@@ -197,9 +199,13 @@ Grammar.extend
grammar_entry_create "fun_binding"
and match_case : 'match_case Grammar.Entry.e =
grammar_entry_create "match_case"
+ and as_patt_opt : 'as_patt_opt Grammar.Entry.e =
+ grammar_entry_create "as_patt_opt"
and label_expr : 'label_expr Grammar.Entry.e =
grammar_entry_create "label_expr"
and fun_def : 'fun_def Grammar.Entry.e = grammar_entry_create "fun_def"
+ and cons_patt_opt : 'cons_patt_opt Grammar.Entry.e =
+ grammar_entry_create "cons_patt_opt"
and label_patt : 'label_patt Grammar.Entry.e =
grammar_entry_create "label_patt"
and label_ipatt : 'label_ipatt Grammar.Entry.e =
@@ -217,10 +223,6 @@ Grammar.extend
and label_declaration : 'label_declaration Grammar.Entry.e =
grammar_entry_create "label_declaration"
and ident : 'ident Grammar.Entry.e = grammar_entry_create "ident"
- and mod_ident : 'mod_ident Grammar.Entry.e =
- grammar_entry_create "mod_ident"
- and direction_flag : 'direction_flag Grammar.Entry.e =
- grammar_entry_create "direction_flag"
and class_declaration : 'class_declaration Grammar.Entry.e =
grammar_entry_create "class_declaration"
and class_fun_binding : 'class_fun_binding Grammar.Entry.e =
@@ -255,8 +257,7 @@ Grammar.extend
grammar_entry_create "opt_tag_list"
and row_field : 'row_field Grammar.Entry.e =
grammar_entry_create "row_field"
- and mutable_flag : 'mutable_flag Grammar.Entry.e =
- grammar_entry_create "mutable_flag"
+ and rec_flag : 'rec_flag Grammar.Entry.e = grammar_entry_create "rec_flag"
and dir_param : 'dir_param Grammar.Entry.e =
grammar_entry_create "dir_param"
and sequence : 'sequence Grammar.Entry.e = grammar_entry_create "sequence"
@@ -264,11 +265,13 @@ Grammar.extend
grammar_entry_create "expr_ident"
and patt_label_ident : 'patt_label_ident Grammar.Entry.e =
grammar_entry_create "patt_label_ident"
+ and when_expr_opt : 'when_expr_opt Grammar.Entry.e =
+ grammar_entry_create "when_expr_opt"
and ipatt : 'ipatt Grammar.Entry.e = grammar_entry_create "ipatt"
- and a_mod_ident : 'a_mod_ident Grammar.Entry.e =
- grammar_entry_create "a_mod_ident"
- and a_direction_flag : 'a_direction_flag Grammar.Entry.e =
- grammar_entry_create "a_direction_flag"
+ and mod_ident : 'mod_ident Grammar.Entry.e =
+ grammar_entry_create "mod_ident"
+ and direction_flag : 'direction_flag Grammar.Entry.e =
+ grammar_entry_create "direction_flag"
and a_class_str_item : 'a_class_str_item Grammar.Entry.e =
grammar_entry_create "a_class_str_item"
and a_class_sig_item : 'a_class_sig_item Grammar.Entry.e =
@@ -284,7 +287,8 @@ Grammar.extend
and anti_ : 'anti_ Grammar.Entry.e = grammar_entry_create "anti_"
and anti_list : 'anti_list Grammar.Entry.e =
grammar_entry_create "anti_list"
- and anti_mut : 'anti_mut Grammar.Entry.e = grammar_entry_create "anti_mut"
+ and mutable_flag : 'mutable_flag Grammar.Entry.e =
+ grammar_entry_create "mutable_flag"
and anti_opt : 'anti_opt Grammar.Entry.e = grammar_entry_create "anti_opt"
and virtual_flag : 'virtual_flag Grammar.Entry.e =
grammar_entry_create "virtual_flag"
@@ -360,18 +364,8 @@ Grammar.extend
(fun (e : 'expr) (loc : int * int) ->
(Node ("StExp", [Loc; e]) : 'str_item));
[Gramext.Stoken ("", "value");
- Gramext.srules
- [[Gramext.Sopt
- (Gramext.srules
- [[Gramext.Stoken ("", "rec")],
- Gramext.action
- (fun (x : string) (loc : int * int) -> (Str x : 'ast))])],
- Gramext.action
- (fun (o : ast option) (loc : int * int) -> (Option o : 'anti));
- [Gramext.Stoken ("ANTIQUOT", "rec")],
- Gramext.action
- (fun (a : string) (loc : int * int) ->
- (antiquot "rec" loc a : 'anti))];
+ Gramext.Snterm
+ (Grammar.Entry.obj (rec_flag : 'rec_flag Grammar.Entry.e));
Gramext.srules
[[Gramext.Slist1sep
(Gramext.Snterm
@@ -386,8 +380,8 @@ Grammar.extend
Gramext.action
(fun (a : 'anti_list) (loc : int * int) -> (a : 'anti))]],
Gramext.action
- (fun (l : ast) (r : ast) _ (loc : int * int) ->
- (Node ("StVal", [Loc; o2b r; l]) : 'str_item));
+ (fun (l : ast) (r : 'rec_flag) _ (loc : int * int) ->
+ (Node ("StVal", [Loc; r; l]) : 'str_item));
[Gramext.Stoken ("", "type");
Gramext.srules
[[Gramext.Slist1sep
@@ -695,7 +689,7 @@ Grammar.extend
Tuple [xx1; xx2; xx3] -> xx1, xx2, xx3
| _ ->
match () with
- _ -> raise (Match_failure ("q_MLast.ml", 7794, 7810))
+ _ -> raise (Match_failure ("q_MLast.ml", 7788, 7804))
in
Node ("SgExc", [Loc; c; tl]) :
'sig_item));
@@ -899,18 +893,8 @@ Grammar.extend
(loc : int * int) ->
(Node ("ExLmd", [Loc; m; mb; e]) : 'expr));
[Gramext.Stoken ("", "let");
- Gramext.srules
- [[Gramext.Sopt
- (Gramext.srules
- [[Gramext.Stoken ("", "rec")],
- Gramext.action
- (fun (x : string) (loc : int * int) -> (Str x : 'ast))])],
- Gramext.action
- (fun (o : ast option) (loc : int * int) -> (Option o : 'anti));
- [Gramext.Stoken ("ANTIQUOT", "rec")],
- Gramext.action
- (fun (a : string) (loc : int * int) ->
- (antiquot "rec" loc a : 'anti))];
+ Gramext.Snterm
+ (Grammar.Entry.obj (rec_flag : 'rec_flag Grammar.Entry.e));
Gramext.srules
[[Gramext.Slist1sep
(Gramext.Snterm
@@ -926,27 +910,18 @@ Grammar.extend
(fun (a : 'anti_list) (loc : int * int) -> (a : 'anti))];
Gramext.Stoken ("", "in"); Gramext.Sself],
Gramext.action
- (fun (x : 'expr) _ (l : ast) (r : ast) _ (loc : int * int) ->
- (Node ("ExLet", [Loc; o2b r; l; x]) : 'expr))];
+ (fun (x : 'expr) _ (l : ast) (r : 'rec_flag) _ (loc : int * int) ->
+ (Node ("ExLet", [Loc; r; l; x]) : 'expr))];
Some "where", None,
[[Gramext.Sself; Gramext.Stoken ("", "where");
- Gramext.srules
- [[Gramext.Sopt
- (Gramext.srules
- [[Gramext.Stoken ("", "rec")],
- Gramext.action
- (fun (x : string) (loc : int * int) -> (Str x : 'ast))])],
- Gramext.action
- (fun (o : ast option) (loc : int * int) -> (Option o : 'anti));
- [Gramext.Stoken ("ANTIQUOT", "rec")],
- Gramext.action
- (fun (a : string) (loc : int * int) ->
- (antiquot "rec" loc a : 'anti))];
+ Gramext.Snterm
+ (Grammar.Entry.obj (rec_flag : 'rec_flag Grammar.Entry.e));
Gramext.Snterm
(Grammar.Entry.obj (let_binding : 'let_binding Grammar.Entry.e))],
Gramext.action
- (fun (lb : 'let_binding) (rf : ast) _ (e : 'expr) (loc : int * int) ->
- (Node ("ExLet", [Loc; o2b rf; List [lb]; e]) : 'expr))];
+ (fun (lb : 'let_binding) (rf : 'rec_flag) _ (e : 'expr)
+ (loc : int * int) ->
+ (Node ("ExLet", [Loc; rf; List [lb]; e]) : 'expr))];
Some ":=", Some Gramext.NonA,
[[Gramext.Sself; Gramext.Stoken ("", ":="); Gramext.Sself;
Gramext.Snterm (Grammar.Entry.obj (dummy : 'dummy Grammar.Entry.e))],
@@ -1351,23 +1326,11 @@ Grammar.extend
(Grammar.Entry.obj (anti_list : 'anti_list Grammar.Entry.e))],
Gramext.action
(fun (a : 'anti_list) (loc : int * int) -> (a : 'anti))];
- Gramext.srules
- [[Gramext.Sopt
- (Gramext.srules
- [[Gramext.Stoken ("", "::");
- Gramext.Snterm
- (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))],
- Gramext.action
- (fun (e : 'expr) _ (loc : int * int) -> (e : 'e__5))])],
- Gramext.action
- (fun (o : 'e__5 option) (loc : int * int) -> (Option o : 'anti));
- [Gramext.Stoken ("ANTIQUOT", "opt")],
- Gramext.action
- (fun (a : string) (loc : int * int) ->
- (antiquot "opt" loc a : 'anti))];
+ Gramext.Snterm
+ (Grammar.Entry.obj (cons_expr_opt : 'cons_expr_opt Grammar.Entry.e));
Gramext.Stoken ("", "]")],
Gramext.action
- (fun _ (last : ast) (el : ast) _ (loc : int * int) ->
+ (fun _ (last : 'cons_expr_opt) (el : ast) _ (loc : int * int) ->
(mklistexp loc last el : 'expr));
[Gramext.Stoken ("", "["); Gramext.Stoken ("", "]")],
Gramext.action
@@ -1394,6 +1357,16 @@ Grammar.extend
Gramext.action
(fun (s : 'a_INT) (loc : int * int) ->
(Node ("ExInt", [Loc; s]) : 'expr))]];
+ Grammar.Entry.obj (cons_expr_opt : 'cons_expr_opt Grammar.Entry.e), None,
+ [None, None,
+ [[],
+ Gramext.action
+ (fun (loc : int * int) -> (Option None : 'cons_expr_opt));
+ [Gramext.Stoken ("", "::");
+ Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))],
+ Gramext.action
+ (fun (e : 'expr) _ (loc : int * int) ->
+ (Option (Some e) : 'cons_expr_opt))]];
Grammar.Entry.obj (dummy : 'dummy Grammar.Entry.e), None,
[None, None,
[[], Gramext.action (fun (loc : int * int) -> (() : 'dummy))]];
@@ -1412,18 +1385,8 @@ Grammar.extend
(fun (el : 'sequence) _ (e : 'expr) (loc : int * int) ->
(Cons (e, el) : 'sequence));
[Gramext.Stoken ("", "let");
- Gramext.srules
- [[Gramext.Sopt
- (Gramext.srules
- [[Gramext.Stoken ("", "rec")],
- Gramext.action
- (fun (x : string) (loc : int * int) -> (Str x : 'ast))])],
- Gramext.action
- (fun (o : ast option) (loc : int * int) -> (Option o : 'anti));
- [Gramext.Stoken ("ANTIQUOT", "rec")],
- Gramext.action
- (fun (a : string) (loc : int * int) ->
- (antiquot "rec" loc a : 'anti))];
+ Gramext.Snterm
+ (Grammar.Entry.obj (rec_flag : 'rec_flag Grammar.Entry.e));
Gramext.srules
[[Gramext.Slist1sep
(Gramext.Snterm
@@ -1439,13 +1402,14 @@ Grammar.extend
(fun (a : 'anti_list) (loc : int * int) -> (a : 'anti))];
Gramext.srules
[[Gramext.Stoken ("", ";")],
- Gramext.action (fun (x : string) (loc : int * int) -> (x : 'e__6));
+ Gramext.action (fun (x : string) (loc : int * int) -> (x : 'e__5));
[Gramext.Stoken ("", "in")],
- Gramext.action (fun (x : string) (loc : int * int) -> (x : 'e__6))];
+ Gramext.action (fun (x : string) (loc : int * int) -> (x : 'e__5))];
Gramext.Sself],
Gramext.action
- (fun (el : 'sequence) _ (l : ast) (o : ast) _ (loc : int * int) ->
- (List [Node ("ExLet", [Loc; o2b o; l; mksequence loc el])] :
+ (fun (el : 'sequence) _ (l : ast) (rf : 'rec_flag) _
+ (loc : int * int) ->
+ (List [Node ("ExLet", [Loc; rf; l; mksequence loc el])] :
'sequence))]];
Grammar.Entry.obj (let_binding : 'let_binding Grammar.Entry.e), None,
[None, None,
@@ -1477,40 +1441,35 @@ Grammar.extend
Grammar.Entry.obj (match_case : 'match_case Grammar.Entry.e), None,
[None, None,
[[Gramext.Snterm (Grammar.Entry.obj (patt : 'patt Grammar.Entry.e));
- Gramext.srules
- [[Gramext.Sopt
- (Gramext.srules
- [[Gramext.Stoken ("", "as");
- Gramext.Snterm
- (Grammar.Entry.obj (patt : 'patt Grammar.Entry.e))],
- Gramext.action
- (fun (p : 'patt) _ (loc : int * int) -> (p : 'e__7))])],
- Gramext.action
- (fun (o : 'e__7 option) (loc : int * int) -> (Option o : 'anti));
- [Gramext.Stoken ("ANTIQUOT", "as")],
- Gramext.action
- (fun (a : string) (loc : int * int) ->
- (antiquot "as" loc a : 'anti))];
- Gramext.srules
- [[Gramext.Sopt
- (Gramext.srules
- [[Gramext.Stoken ("", "when");
- Gramext.Snterm
- (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))],
- Gramext.action
- (fun (e : 'expr) _ (loc : int * int) -> (e : 'e__8))])],
- Gramext.action
- (fun (o : 'e__8 option) (loc : int * int) -> (Option o : 'anti));
- [Gramext.Stoken ("ANTIQUOT", "when")],
- Gramext.action
- (fun (a : string) (loc : int * int) ->
- (antiquot "when" loc a : 'anti))];
+ Gramext.Snterm
+ (Grammar.Entry.obj (as_patt_opt : 'as_patt_opt Grammar.Entry.e));
+ Gramext.Snterm
+ (Grammar.Entry.obj (when_expr_opt : 'when_expr_opt Grammar.Entry.e));
Gramext.Stoken ("", "->");
Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))],
Gramext.action
- (fun (e : 'expr) _ (w : ast) (aso : ast) (p : 'patt)
- (loc : int * int) ->
+ (fun (e : 'expr) _ (w : 'when_expr_opt) (aso : 'as_patt_opt)
+ (p : 'patt) (loc : int * int) ->
(mkmatchcase loc p aso w e : 'match_case))]];
+ Grammar.Entry.obj (as_patt_opt : 'as_patt_opt Grammar.Entry.e), None,
+ [None, None,
+ [[],
+ Gramext.action (fun (loc : int * int) -> (Option None : 'as_patt_opt));
+ [Gramext.Stoken ("", "as");
+ Gramext.Snterm (Grammar.Entry.obj (patt : 'patt Grammar.Entry.e))],
+ Gramext.action
+ (fun (p : 'patt) _ (loc : int * int) ->
+ (Option (Some p) : 'as_patt_opt))]];
+ Grammar.Entry.obj (when_expr_opt : 'when_expr_opt Grammar.Entry.e), None,
+ [None, None,
+ [[],
+ Gramext.action
+ (fun (loc : int * int) -> (Option None : 'when_expr_opt));
+ [Gramext.Stoken ("", "when");
+ Gramext.Snterm (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))],
+ Gramext.action
+ (fun (e : 'expr) _ (loc : int * int) ->
+ (Option (Some e) : 'when_expr_opt))]];
Grammar.Entry.obj (label_expr : 'label_expr Grammar.Entry.e), None,
[None, None,
[[Gramext.Snterm
@@ -1654,23 +1613,11 @@ Grammar.extend
(Grammar.Entry.obj (anti_list : 'anti_list Grammar.Entry.e))],
Gramext.action
(fun (a : 'anti_list) (loc : int * int) -> (a : 'anti))];
- Gramext.srules
- [[Gramext.Sopt
- (Gramext.srules
- [[Gramext.Stoken ("", "::");
- Gramext.Snterm
- (Grammar.Entry.obj (patt : 'patt Grammar.Entry.e))],
- Gramext.action
- (fun (p : 'patt) _ (loc : int * int) -> (p : 'e__9))])],
- Gramext.action
- (fun (o : 'e__9 option) (loc : int * int) -> (Option o : 'anti));
- [Gramext.Stoken ("ANTIQUOT", "opt")],
- Gramext.action
- (fun (a : string) (loc : int * int) ->
- (antiquot "opt" loc a : 'anti))];
+ Gramext.Snterm
+ (Grammar.Entry.obj (cons_patt_opt : 'cons_patt_opt Grammar.Entry.e));
Gramext.Stoken ("", "]")],
Gramext.action
- (fun _ (last : ast) (pl : ast) _ (loc : int * int) ->
+ (fun _ (last : 'cons_patt_opt) (pl : ast) _ (loc : int * int) ->
(mklistpat loc last pl : 'patt));
[Gramext.Stoken ("", "["); Gramext.Stoken ("", "]")],
Gramext.action
@@ -1715,6 +1662,16 @@ Grammar.extend
Gramext.action
(fun (s : 'a_LIDENT) (loc : int * int) ->
(Node ("PaLid", [Loc; s]) : 'patt))]];
+ Grammar.Entry.obj (cons_patt_opt : 'cons_patt_opt Grammar.Entry.e), None,
+ [None, None,
+ [[],
+ Gramext.action
+ (fun (loc : int * int) -> (Option None : 'cons_patt_opt));
+ [Gramext.Stoken ("", "::");
+ Gramext.Snterm (Grammar.Entry.obj (patt : 'patt Grammar.Entry.e))],
+ Gramext.action
+ (fun (p : 'patt) _ (loc : int * int) ->
+ (Option (Some p) : 'cons_patt_opt))]];
Grammar.Entry.obj (label_patt : 'label_patt Grammar.Entry.e), None,
[None, None,
[[Gramext.Snterm
@@ -2047,11 +2004,12 @@ Grammar.extend
[Gramext.Snterm
(Grammar.Entry.obj (a_UIDENT : 'a_UIDENT Grammar.Entry.e))],
Gramext.action
- (fun (i : 'a_UIDENT) (loc : int * int) -> (List [i] : 'mod_ident));
- [Gramext.Snterm
- (Grammar.Entry.obj (a_mod_ident : 'a_mod_ident Grammar.Entry.e))],
- Gramext.action
- (fun (a : 'a_mod_ident) (loc : int * int) -> (a : 'mod_ident))]];
+ (fun (i : 'a_UIDENT) (loc : int * int) -> (List [i] : 'mod_ident))]];
+ Grammar.Entry.obj (rec_flag : 'rec_flag Grammar.Entry.e), None,
+ [None, None,
+ [[], Gramext.action (fun (loc : int * int) -> (Bool false : 'rec_flag));
+ [Gramext.Stoken ("", "rec")],
+ Gramext.action (fun _ (loc : int * int) -> (Bool true : 'rec_flag))]];
Grammar.Entry.obj (direction_flag : 'direction_flag Grammar.Entry.e),
None,
[None, None,
@@ -2060,13 +2018,14 @@ Grammar.extend
(fun _ (loc : int * int) -> (Bool false : 'direction_flag));
[Gramext.Stoken ("", "to")],
Gramext.action
- (fun _ (loc : int * int) -> (Bool true : 'direction_flag));
- [Gramext.Snterm
- (Grammar.Entry.obj
- (a_direction_flag : 'a_direction_flag Grammar.Entry.e))],
+ (fun _ (loc : int * int) -> (Bool true : 'direction_flag))]];
+ Grammar.Entry.obj (mutable_flag : 'mutable_flag Grammar.Entry.e), None,
+ [None, None,
+ [[],
+ Gramext.action (fun (loc : int * int) -> (Bool false : 'mutable_flag));
+ [Gramext.Stoken ("", "mutable")],
Gramext.action
- (fun (a : 'a_direction_flag) (loc : int * int) ->
- (a : 'direction_flag))]];
+ (fun _ (loc : int * int) -> (Bool true : 'mutable_flag))]];
Grammar.Entry.obj (str_item : 'str_item Grammar.Entry.e), None,
[None, None,
[[Gramext.Stoken ("", "class"); Gramext.Stoken ("", "type");
@@ -2345,9 +2304,9 @@ Grammar.extend
Gramext.Stoken ("", ";")],
Gramext.action
(fun _ (cf : 'class_str_item) (loc : int * int) ->
- (cf : 'e__10))])],
+ (cf : 'e__6))])],
Gramext.action
- (fun (l : 'e__10 list) (loc : int * int) -> (List l : 'anti));
+ (fun (l : 'e__6 list) (loc : int * int) -> (List l : 'anti));
[Gramext.Snterm
(Grammar.Entry.obj (anti_list : 'anti_list Grammar.Entry.e))],
Gramext.action
@@ -2431,9 +2390,9 @@ Grammar.extend
(a_LIDENT : 'a_LIDENT Grammar.Entry.e))],
Gramext.action
(fun (i : 'a_LIDENT) _ (loc : int * int) ->
- (i : 'e__12))])],
+ (i : 'e__8))])],
Gramext.action
- (fun (o : 'e__12 option) (loc : int * int) -> (Option o : 'anti));
+ (fun (o : 'e__8 option) (loc : int * int) -> (Option o : 'anti));
[Gramext.Stoken ("ANTIQUOT", "as")],
Gramext.action
(fun (a : string) (loc : int * int) ->
@@ -2451,9 +2410,9 @@ Grammar.extend
Gramext.Stoken ("", ";")],
Gramext.action
(fun _ (s : 'class_str_item) (loc : int * int) ->
- (s : 'e__11))])],
+ (s : 'e__7))])],
Gramext.action
- (fun (l : 'e__11 list) (loc : int * int) -> (List l : 'anti));
+ (fun (l : 'e__7 list) (loc : int * int) -> (List l : 'anti));
[Gramext.Snterm
(Grammar.Entry.obj (anti_list : 'anti_list Grammar.Entry.e))],
Gramext.action
@@ -2544,9 +2503,9 @@ Grammar.extend
Gramext.Stoken ("", ";")],
Gramext.action
(fun _ (csf : 'class_sig_item) (loc : int * int) ->
- (csf : 'e__13))])],
+ (csf : 'e__9))])],
Gramext.action
- (fun (l : 'e__13 list) (loc : int * int) -> (List l : 'anti));
+ (fun (l : 'e__9 list) (loc : int * int) -> (List l : 'anti));
[Gramext.Snterm
(Grammar.Entry.obj (anti_list : 'anti_list Grammar.Entry.e))],
Gramext.action
@@ -2663,9 +2622,9 @@ Grammar.extend
Gramext.Stoken ("", ";")],
Gramext.action
(fun _ (s : 'class_sig_item) (loc : int * int) ->
- (s : 'e__14))])],
+ (s : 'e__10))])],
Gramext.action
- (fun (l : 'e__14 list) (loc : int * int) -> (List l : 'anti));
+ (fun (l : 'e__10 list) (loc : int * int) -> (List l : 'anti));
[Gramext.Snterm
(Grammar.Entry.obj (anti_list : 'anti_list Grammar.Entry.e))],
Gramext.action
@@ -3063,10 +3022,10 @@ Grammar.extend
Gramext.Snterm
(Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))],
Gramext.action
- (fun (e : 'expr) _ (loc : int * int) -> (e : 'e__16))]);
+ (fun (e : 'expr) _ (loc : int * int) -> (e : 'e__12))]);
Gramext.Stoken ("", ")")],
Gramext.action
- (fun _ (e : 'e__16 option) (t : 'ctyp) _ (p : 'patt) _ _
+ (fun _ (e : 'e__12 option) (t : 'ctyp) _ (p : 'patt) _ _
(i : 'a_LIDENT) _ (loc : int * int) ->
(let p = Node ("PaTyc", [Loc; p; t]) in
Node ("PaOlb", [Loc; i; p; Option e]) :
@@ -3081,10 +3040,10 @@ Grammar.extend
Gramext.Snterm
(Grammar.Entry.obj (expr : 'expr Grammar.Entry.e))],
Gramext.action
- (fun (e : 'expr) _ (loc : int * int) -> (e : 'e__15))]);
+ (fun (e : 'expr) _ (loc : int * int) -> (e : 'e__11))]);
Gramext.Stoken ("", ")")],
Gramext.action
- (fun _ (e : 'e__15 option) (p : 'patt) _ _ (i : 'a_LIDENT) _
+ (fun _ (e : 'e__11 option) (p : 'patt) _ _ (i : 'a_LIDENT) _
(loc : int * int) ->
(Node ("PaOlb", [Loc; i; p; Option e]) : 'patt));
[Gramext.Stoken ("", "~");
@@ -3166,16 +3125,6 @@ Grammar.extend
Gramext.action
(fun (s : 'ident) _ (loc : int * int) ->
(Node ("ExVrn", [Loc; s]) : 'expr))]];
- Grammar.Entry.obj (mutable_flag : 'mutable_flag Grammar.Entry.e), None,
- [None, None,
- [[],
- Gramext.action (fun (loc : int * int) -> (Bool false : 'mutable_flag));
- [Gramext.Stoken ("", "mutable")],
- Gramext.action (fun _ (loc : int * int) -> (Bool true : 'mutable_flag));
- [Gramext.Snterm
- (Grammar.Entry.obj (anti_mut : 'anti_mut Grammar.Entry.e))],
- Gramext.action
- (fun (a : 'anti_mut) (loc : int * int) -> (a : 'mutable_flag))]];
Grammar.Entry.obj (str_item : 'str_item Grammar.Entry.e), None,
[None, None,
[[Gramext.Stoken ("", "#");
@@ -3186,6 +3135,12 @@ Grammar.extend
Gramext.action
(fun (dp : 'dir_param) (n : 'a_LIDENT) _ (loc : int * int) ->
(Node ("StDir", [Loc; n; dp]) : 'str_item))]];
+ Grammar.Entry.obj (rec_flag : 'rec_flag Grammar.Entry.e), None,
+ [None, None,
+ [[Gramext.Stoken ("ANTIQUOT", "rec")],
+ Gramext.action
+ (fun (a : string) (loc : int * int) ->
+ (antiquot "rec" loc a : 'rec_flag))]];
Grammar.Entry.obj (sig_item : 'sig_item Grammar.Entry.e), None,
[None, None,
[[Gramext.Stoken ("", "#");
@@ -3312,6 +3267,12 @@ Grammar.extend
Gramext.action
(fun (a : string) (loc : int * int) ->
(antiquot "" loc a : 'patt_label_ident))]];
+ Grammar.Entry.obj (when_expr_opt : 'when_expr_opt Grammar.Entry.e), None,
+ [None, None,
+ [[Gramext.Stoken ("ANTIQUOT", "when")],
+ Gramext.action
+ (fun (a : string) (loc : int * int) ->
+ (antiquot "when" loc a : 'when_expr_opt))]];
Grammar.Entry.obj (ipatt : 'ipatt Grammar.Entry.e), None,
[None, None,
[[Gramext.Stoken ("", "(");
@@ -3349,19 +3310,19 @@ Grammar.extend
Gramext.action
(fun (a : string) (loc : int * int) ->
(antiquot "typ" loc a : 'ctyp))]];
- Grammar.Entry.obj (a_mod_ident : 'a_mod_ident Grammar.Entry.e), None,
+ Grammar.Entry.obj (mod_ident : 'mod_ident Grammar.Entry.e), None,
[None, None,
[[Gramext.Stoken ("ANTIQUOT", "")],
Gramext.action
(fun (a : string) (loc : int * int) ->
- (antiquot "" loc a : 'a_mod_ident))]];
- Grammar.Entry.obj (a_direction_flag : 'a_direction_flag Grammar.Entry.e),
+ (antiquot "" loc a : 'mod_ident))]];
+ Grammar.Entry.obj (direction_flag : 'direction_flag Grammar.Entry.e),
None,
[None, None,
[[Gramext.Stoken ("ANTIQUOT", "to")],
Gramext.action
(fun (a : string) (loc : int * int) ->
- (antiquot "to" loc a : 'a_direction_flag))]];
+ (antiquot "to" loc a : 'direction_flag))]];
Grammar.Entry.obj (a_class_str_item : 'a_class_str_item Grammar.Entry.e),
None,
[None, None,
@@ -3469,12 +3430,12 @@ Grammar.extend
Gramext.action
(fun (a : string) (loc : int * int) ->
(antiquot "list" loc a : 'anti_list))]];
- Grammar.Entry.obj (anti_mut : 'anti_mut Grammar.Entry.e), None,
+ Grammar.Entry.obj (mutable_flag : 'mutable_flag Grammar.Entry.e), None,
[None, None,
[[Gramext.Stoken ("ANTIQUOT", "mut")],
Gramext.action
(fun (a : string) (loc : int * int) ->
- (antiquot "mut" loc a : 'anti_mut))]];
+ (antiquot "mut" loc a : 'mutable_flag))]];
Grammar.Entry.obj (anti_opt : 'anti_opt Grammar.Entry.e), None,
[None, None,
[[Gramext.Stoken ("ANTIQUOT", "opt")],
@@ -3492,9 +3453,9 @@ Grammar.extend
(Grammar.Entry.obj (expr : 'expr Grammar.Entry.e));
Gramext.Stoken ("", ";")],
Gramext.action
- (fun _ (e : 'expr) (loc : int * int) -> (e : 'e__19))])],
+ (fun _ (e : 'expr) (loc : int * int) -> (e : 'e__15))])],
Gramext.action
- (fun (l : 'e__19 list) (loc : int * int) -> (List l : 'anti));
+ (fun (l : 'e__15 list) (loc : int * int) -> (List l : 'anti));
[Gramext.Snterm
(Grammar.Entry.obj (anti_list : 'anti_list Grammar.Entry.e))],
Gramext.action
@@ -3518,9 +3479,9 @@ Grammar.extend
(Grammar.Entry.obj (expr : 'expr Grammar.Entry.e));
Gramext.Stoken ("", ";")],
Gramext.action
- (fun _ (e : 'expr) (loc : int * int) -> (e : 'e__18))])],
+ (fun _ (e : 'expr) (loc : int * int) -> (e : 'e__14))])],
Gramext.action
- (fun (l : 'e__18 list) (loc : int * int) -> (List l : 'anti));
+ (fun (l : 'e__14 list) (loc : int * int) -> (List l : 'anti));
[Gramext.Snterm
(Grammar.Entry.obj (anti_list : 'anti_list Grammar.Entry.e))],
Gramext.action
@@ -3540,9 +3501,9 @@ Grammar.extend
(Grammar.Entry.obj (expr : 'expr Grammar.Entry.e));
Gramext.Stoken ("", ";")],
Gramext.action
- (fun _ (e : 'expr) (loc : int * int) -> (e : 'e__17))])],
+ (fun _ (e : 'expr) (loc : int * int) -> (e : 'e__13))])],
Gramext.action
- (fun (l : 'e__17 list) (loc : int * int) -> (List l : 'anti));
+ (fun (l : 'e__13 list) (loc : int * int) -> (List l : 'anti));
[Gramext.Snterm
(Grammar.Entry.obj (anti_list : 'anti_list Grammar.Entry.e))],
Gramext.action