summaryrefslogtreecommitdiffstats
path: root/camlp4
diff options
context:
space:
mode:
authorDaniel de Rauglaudre <daniel.de_rauglaudre@inria.fr>2002-01-26 04:24:54 +0000
committerDaniel de Rauglaudre <daniel.de_rauglaudre@inria.fr>2002-01-26 04:24:54 +0000
commitea6450290e34fa4b76c0c919310ee5a22da24329 (patch)
tree2b598d7e531c1f1a42fd0adcb37553150a56f0db /camlp4
parent2862f1e2a2bd67b055b4fc129f5fc2507f40700c (diff)
-
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@4317 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'camlp4')
-rw-r--r--camlp4/etc/pr_extend.ml10
-rw-r--r--camlp4/meta/pa_extend.ml37
-rw-r--r--camlp4/meta/pa_extend_m.ml8
-rw-r--r--camlp4/meta/pa_r.ml88
-rw-r--r--camlp4/meta/q_MLast.ml65
-rw-r--r--camlp4/ocaml_src/meta/pa_extend.ml41
-rw-r--r--camlp4/ocaml_src/meta/pa_extend_m.ml13
-rw-r--r--camlp4/ocaml_src/meta/pa_r.ml217
-rw-r--r--camlp4/ocaml_src/meta/q_MLast.ml414
9 files changed, 493 insertions, 400 deletions
diff --git a/camlp4/etc/pr_extend.ml b/camlp4/etc/pr_extend.ml
index a676a2910..ec1e51916 100644
--- a/camlp4/etc/pr_extend.ml
+++ b/camlp4/etc/pr_extend.ml
@@ -300,9 +300,9 @@ value rec symbol s k =
| Stoken tok -> token tok k
| Srules
[([(Some <:patt< a >>, Snterm <:expr< a_list >>)], Some <:expr< a >>);
- ([(Some <:patt< l >>,
+ ([(Some <:patt< a >>,
((Slist0 _ | Slist1 _ | Slist0sep _ _ | Slist1sep _ _) as s))],
- Some <:expr< List l >>)]
+ Some <:expr< List a >>)]
when not no_slist.val
->
match s with
@@ -317,6 +317,12 @@ value rec symbol s k =
[: `S LR "SLIST1"; `simple_symbol s [: :]; `S LR "SEP";
`simple_symbol sep k :]
| _ -> assert False ]
+ | Srules
+ [([(Some <:patt< a >>, Snterm <:expr< a_opt >>)], Some <:expr< a >>);
+ ([(Some <:patt< a >>, Sopt s)], Some <:expr< Option a >>)]
+ when not no_slist.val
+ ->
+ HVbox [: `S LR "SOPT"; `simple_symbol s k :]
| Srules rl ->
let rl = simplify_rules rl in
HVbox [: `HVbox [: :]; rule_list rl k :] ]
diff --git a/camlp4/meta/pa_extend.ml b/camlp4/meta/pa_extend.ml
index 884a6f91e..380798908 100644
--- a/camlp4/meta/pa_extend.ml
+++ b/camlp4/meta/pa_extend.ml
@@ -510,10 +510,10 @@ value sslist_aux loc min sep s =
{used = []; text = slist loc min sep s;
styp = STapp loc "list" s.styp}
in
- let patt = <:patt< l >> in
+ let patt = <:patt< a >> in
{pattern = Some patt; symbol = symb}
in
- let act = <:expr< List l >> in
+ let act = <:expr< List a >> in
{prod = [psymb]; action = Some act}
in
[r1; r2]
@@ -527,6 +527,37 @@ value sslist loc min sep s =
| _ -> sslist_aux loc min sep s ]
;
+value ssopt loc s =
+ let psymbol p s t =
+ let symb = {used = []; text = s; styp = t} in
+ {pattern = Some p; symbol = symb}
+ in
+ let rl =
+ let r1 =
+ let prod =
+ let n = mk_name loc <:expr< a_opt >> in
+ [psymbol <:patt< a >> (TXnterm loc n None) (STquo loc "a_opt")]
+ in
+ let act = <:expr< a >> in
+ {prod = prod; action = Some act}
+ in
+ let r2 =
+ let psymb =
+ let symb =
+ {used = []; text = TXopt loc s.text;
+ styp = STapp loc "option" s.styp}
+ in
+ let patt = <:patt< a >> in
+ {pattern = Some patt; symbol = symb}
+ in
+ let act = <:expr< Option a >> in
+ {prod = [psymb]; action = Some act}
+ in
+ [r1; r2]
+ in
+ TXrules loc (srules loc "anti" rl "")
+;
+
value is_global e =
fun
[ None -> True
@@ -775,7 +806,7 @@ EXTEND
{used = used; text = text; styp = styp}
| UIDENT "OPT"; s = SELF ->
let styp = STapp loc "option" s.styp in
- let text = TXopt loc s.text in
+ let text = if quotify.val then ssopt loc s else TXopt loc s.text in
{used = s.used; text = text; styp = styp} ]
| [ UIDENT "SELF" ->
{used = []; text = TXself loc; styp = STprm loc "SELF"}
diff --git a/camlp4/meta/pa_extend_m.ml b/camlp4/meta/pa_extend_m.ml
index 9a6f86ae5..005da286e 100644
--- a/camlp4/meta/pa_extend_m.ml
+++ b/camlp4/meta/pa_extend_m.ml
@@ -21,10 +21,14 @@ EXTEND
s = SELF; sep = OPT [ UIDENT "SEP"; t = symbol -> t ] ->
let used =
match sep with
- [ Some symb -> [mk_name loc <:expr< anti >> :: symb.used @ s.used]
+ [ Some symb -> symb.used @ s.used
| None -> s.used ]
in
+ let used = [mk_name loc <:expr< a_list >> :: used] in
{used = used; text = sslist loc min sep s;
- styp = STlid loc "ast"} ] ]
+ styp = STlid loc "ast"}
+ | UIDENT "SOPT"; s = SELF ->
+ let used = [mk_name loc <:expr< a_opt >> :: s.used] in
+ {used = used; text = ssopt loc s; styp = STlid loc "ast"} ] ]
;
END;
diff --git a/camlp4/meta/pa_r.ml b/camlp4/meta/pa_r.ml
index 47edd970c..903de0f7b 100644
--- a/camlp4/meta/pa_r.ml
+++ b/camlp4/meta/pa_r.ml
@@ -150,6 +150,8 @@ value mkassert loc e =
else <:expr< if $e$ then () else $raiser$ >> ]
;
+value append_elem el e = el @ [e];
+
(* ...suppose to flush the input in case of syntax error to avoid multiple
errors in case of cut-and-paste in the xterm, but work bad: for example
the input "for x = 1;" waits for another line before displaying the
@@ -166,11 +168,22 @@ and sync_semi cs =
Pcaml.sync.val := sync;
*)
-value type_parameter = Grammar.Entry.create gram "type_parameter";
-value fun_binding = Grammar.Entry.create gram "fun_binding";
value ipatt = Grammar.Entry.create gram "ipatt";
-value direction_flag = Grammar.Entry.create gram "direction_flag";
-value mod_ident = Grammar.Entry.create gram "mod_ident";
+
+value not_yet_warned = ref True;
+value warning_seq () =
+ if not_yet_warned.val then do {
+ not_yet_warned.val := False;
+ Printf.eprintf "\
+*** warning: use of old syntax
+*** type \"camlp4r -help_seq\" in a shell for explanations
+";
+ flush stderr
+ }
+ else ()
+;
+Pcaml.add_option "-no_warn_seq" (Arg.Clear not_yet_warned)
+ " No warning when using old syntax for sequences.";
EXTEND
GLOBAL: interf implem use_file top_phrase;
@@ -211,8 +224,7 @@ END;
EXTEND
GLOBAL: sig_item str_item ctyp patt expr module_type module_expr class_type
- class_expr class_sig_item class_str_item
- let_binding type_parameter fun_binding ipatt direction_flag mod_ident;
+ class_expr class_sig_item class_str_item let_binding ipatt;
module_expr:
[ [ "functor"; "("; i = UIDENT; ":"; t = module_type; ")"; "->";
me = SELF ->
@@ -619,7 +631,7 @@ EXTEND
[ ci = class_longident; "["; ctcl = LIST0 ctyp SEP ","; "]" ->
<:class_expr< $list:ci$ [ $list:ctcl$ ] >>
| ci = class_longident -> <:class_expr< $list:ci$ >>
- | "object"; cspo = class_self_patt_opt; cf = class_structure; "end" ->
+ | "object"; cspo = OPT class_self_patt; cf = class_structure; "end" ->
<:class_expr< object $opt:cspo$ $list:cf$ end >>
| "("; ce = SELF; ":"; ct = class_type; ")" ->
<:class_expr< ($ce$ : $ct$) >>
@@ -628,10 +640,9 @@ EXTEND
class_structure:
[ [ cf = LIST0 [ cf = class_str_item; ";" -> cf ] -> cf ] ]
;
- class_self_patt_opt:
- [ [ "("; p = patt; ")" -> Some p
- | "("; p = patt; ":"; t = ctyp; ")" -> Some <:patt< ($p$ : $t$) >>
- | -> None ] ]
+ class_self_patt:
+ [ [ "("; p = patt; ")" -> p
+ | "("; p = patt; ":"; t = ctyp; ")" -> <:patt< ($p$ : $t$) >> ] ]
;
class_str_item:
[ [ "declare"; st = LIST0 [ s= class_str_item; ";" -> s ]; "end" ->
@@ -675,13 +686,12 @@ EXTEND
| id = clty_longident; "["; tl = LIST1 ctyp SEP ","; "]" ->
<:class_type< $list:id$ [ $list:tl$ ] >>
| id = clty_longident -> <:class_type< $list:id$ >>
- | "object"; cst = class_self_type_opt;
+ | "object"; cst = OPT class_self_type;
csf = LIST0 [ csf = class_sig_item; ";" -> csf ]; "end" ->
<:class_type< object $opt:cst$ $list:csf$ end >> ] ]
;
- class_self_type_opt:
- [ [ "("; t = ctyp; ")" -> Some t
- | -> None ] ]
+ class_self_type:
+ [ [ "("; t = ctyp; ")" -> t ] ]
;
class_sig_item:
[ [ "declare"; st = LIST0 [ s = class_sig_item; ";" -> s ]; "end" ->
@@ -855,6 +865,21 @@ EXTEND
[ [ "&" -> True
| -> False ] ]
;
+ (* Compatibility old syntax of sequences *)
+ expr: LEVEL "top"
+ [ [ "do"; seq = LIST0 [ e = expr; ";" -> e ]; "return"; warning_sequence;
+ e = SELF ->
+ <:expr< do { $list:append_elem seq e$ } >>
+ | "for"; i = LIDENT; "="; e1 = SELF; df = direction_flag; e2 = SELF;
+ "do"; seq = LIST0 [ e = expr; ";" -> e ]; warning_sequence; "done" ->
+ <:expr< for $i$ = $e1$ $to:df$ $e2$ do { $list:seq$ } >>
+ | "while"; e = SELF; "do"; seq = LIST0 [ e = expr; ";" -> e ];
+ warning_sequence; "done" ->
+ <:expr< while $e$ do { $list:seq$ } >> ] ]
+ ;
+ warning_sequence:
+ [ [ -> warning_seq () ] ]
+ ;
END;
EXTEND
@@ -903,36 +928,3 @@ EXTEND
Pcaml.handle_patt_quotation loc x ] ]
;
END;
-
-(* Old syntax for sequences *)
-
-value not_yet_warned = ref True;
-value warning_seq () =
- if not_yet_warned.val then do {
- not_yet_warned.val := False;
- Printf.eprintf "\
-*** warning: use of old syntax
-*** type \"camlp4r -help_seq\" in a shell for explanations
-";
- flush stderr
- }
- else ()
-;
-Pcaml.add_option "-no_warn_seq" (Arg.Clear not_yet_warned)
- " No warning when using old syntax for sequences.";
-
-EXTEND
- GLOBAL: expr direction_flag;
- expr: LEVEL "top"
- [ [ "do"; seq = LIST0 [ e = expr; ";" -> e ]; "return"; e = SELF ->
- do { warning_seq (); <:expr< do { $list:seq @ [e]$ } >> }
- | "for"; i = LIDENT; "="; e1 = SELF; df = direction_flag; e2 = SELF;
- "do"; seq = LIST0 [ e = expr; ";" -> e ]; "done" ->
- do {
- warning_seq ();
- <:expr< for $i$ = $e1$ $to:df$ $e2$ do { $list:seq$ } >>
- }
- | "while"; e = SELF; "do"; seq = LIST0 [ e = expr; ";" -> e ]; "done" ->
- do { warning_seq (); <:expr< while $e$ do { $list:seq$ } >> } ] ]
- ;
-END;
diff --git a/camlp4/meta/q_MLast.ml b/camlp4/meta/q_MLast.ml
index b29ce264e..faa9c73d9 100644
--- a/camlp4/meta/q_MLast.ml
+++ b/camlp4/meta/q_MLast.ml
@@ -50,6 +50,9 @@ value class_expr = Grammar.Entry.create gram "class expr";
value class_sig_item = Grammar.Entry.create gram "class signature item";
value class_str_item = Grammar.Entry.create gram "class structure item";
+value ipatt = Grammar.Entry.create gram "ipatt";
+value let_binding = Grammar.Entry.create gram "let_binding";
+
value o2b =
fun
[ Option (Some _) -> Bool True
@@ -147,12 +150,13 @@ value mkassert loc e =
else Node "ExIfe" [Loc; e; Node "ExUid" [Loc; Str "()"]; raiser] ]
;
+value append_elem el e = Append el e;
+
value not_yet_warned = ref True;
value warning_seq () =
if not_yet_warned.val then do {
not_yet_warned.val := False;
- Printf.eprintf
- "\
+ Printf.eprintf "\
*** warning: use of old syntax for sequences in expr quotation\n";
flush stderr
}
@@ -161,7 +165,7 @@ value warning_seq () =
EXTEND
GLOBAL: sig_item str_item ctyp patt expr module_type module_expr class_type
- class_expr class_sig_item class_str_item;
+ class_expr class_sig_item class_str_item let_binding ipatt;
module_expr:
[ [ "functor"; "("; i = a_UIDENT; ":"; t = module_type; ")"; "->";
me = SELF ->
@@ -638,7 +642,7 @@ EXTEND
[ ci = class_longident; "["; ctcl = SLIST0 ctyp SEP ","; "]" ->
Node "CeCon" [Loc; ci; ctcl]
| ci = class_longident -> Node "CeCon" [Loc; ci; List []]
- | "object"; cspo = class_self_patt_opt; cf = class_structure; "end" ->
+ | "object"; cspo = SOPT class_self_patt; cf = class_structure; "end" ->
Node "CeStr" [Loc; cspo; cf]
| "("; ce = SELF; ":"; ct = class_type; ")" ->
Node "CeTyc" [Loc; ce; ct]
@@ -647,11 +651,9 @@ EXTEND
class_structure:
[ [ cf = SLIST0 [ cf = class_str_item; ";" -> cf ] -> cf ] ]
;
- class_self_patt_opt:
- [ [ "("; p = patt; ")" -> Option (Some p)
- | "("; p = patt; ":"; t = ctyp; ")" ->
- Option (Some (Node "PaTyc" [Loc; p; t]))
- | -> Option None ] ]
+ class_self_patt:
+ [ [ "("; p = patt; ")" -> p
+ | "("; p = patt; ":"; t = ctyp; ")" -> Node "PaTyc" [Loc; p; t] ] ]
;
class_str_item:
[ [ "declare"; st = SLIST0 [ s = class_str_item; ";" -> s ]; "end" ->
@@ -698,13 +700,12 @@ EXTEND
| id = clty_longident; "["; tl = SLIST1 ctyp SEP ","; "]" ->
Node "CtCon" [Loc; id; tl]
| id = clty_longident -> Node "CtCon" [Loc; id; List []]
- | "object"; cst = class_self_type_opt;
+ | "object"; cst = SOPT class_self_type;
csf = SLIST0 [ csf = class_sig_item; ";" -> csf ]; "end" ->
Node "CtSig" [Loc; cst; csf] ] ]
;
- class_self_type_opt:
- [ [ "("; t = ctyp; ")" -> Option (Some t)
- | -> Option None ] ]
+ class_self_type:
+ [ [ "("; t = ctyp; ")" -> t ] ]
;
class_sig_item:
[ [ "declare"; st = SLIST0 [ s = class_sig_item; ";" -> s ]; "end" ->
@@ -893,6 +894,21 @@ EXTEND
[ [ "&" -> Bool True
| -> Bool False ] ]
;
+ (* Compatibility old syntax of sequences *)
+ expr: LEVEL "top"
+ [ [ "do"; seq = SLIST0 [ e = expr; ";" -> e ]; "return"; warning_sequence;
+ e = SELF ->
+ Node "ExSeq" [Loc; append_elem seq e]
+ | "for"; i = a_LIDENT; "="; e1 = SELF; df = direction_flag; e2 = SELF;
+ "do"; seq = SLIST0 [ e = expr; ";" -> e ]; warning_sequence; "done" ->
+ Node "ExFor" [Loc; i; e1; e2; df; seq]
+ | "while"; e = SELF; "do"; seq = SLIST0 [ e = expr; ";" -> e ];
+ warning_sequence; "done" ->
+ Node "ExWhi" [Loc; e; seq] ] ]
+ ;
+ warning_sequence:
+ [ [ -> warning_seq () ] ]
+ ;
(* Antiquotations *)
str_item:
[ [ "#"; n = a_LIDENT; dp = dir_param -> Node "StDir" [Loc; n; dp] ] ]
@@ -971,15 +987,9 @@ EXTEND
class_type:
[ [ a = ANTIQUOT "" -> antiquot "" loc a ] ]
;
- class_self_patt_opt:
- [ [ a = ANTIQUOT "opt" -> antiquot "opt" loc a ] ]
- ;
as_lident_opt:
[ [ a = ANTIQUOT "as" -> antiquot "as" loc a ] ]
;
- class_self_type_opt:
- [ [ a = ANTIQUOT "opt" -> antiquot "opt" loc a ] ]
- ;
meth_list:
[ [ a = a_list -> Tuple [a; Bool False]
| a = a_list; b = ANTIQUOT -> Tuple [a; antiquot "" loc b] ] ]
@@ -999,6 +1009,9 @@ EXTEND
a_list:
[ [ a = ANTIQUOT "list" -> antiquot "list" loc a ] ]
;
+ a_opt:
+ [ [ a = ANTIQUOT "opt" -> antiquot "opt" loc a ] ]
+ ;
a_UIDENT:
[ [ a = ANTIQUOT "uid" -> antiquot "uid" loc a
| a = ANTIQUOT "" -> antiquot "" loc a
@@ -1052,20 +1065,6 @@ EXTEND
amp_flag:
[ [ a = ANTIQUOT "opt" -> antiquot "opt" loc a ] ]
;
- (* Compatibility old syntax of sequences *)
- expr: LEVEL "top"
- [ [ "do"; seq = SLIST0 [ e = expr; ";" -> e ]; "return"; e = SELF ->
- let _ = warning_seq () in
- Node "ExSeq" [Loc; Append seq e]
- | "for"; i = a_LIDENT; "="; e1 = SELF; df = direction_flag; e2 = SELF;
- "do"; seq = SLIST0 [ e = expr; ";" -> e ]; "done" ->
- let _ = warning_seq () in
- Node "ExFor" [Loc; i; e1; e2; df; seq]
- | "while"; e = SELF; "do"; seq = SLIST0 [ e = expr; ";" -> e ];
- "done" ->
- let _ = warning_seq () in
- Node "ExWhi" [Loc; e; seq] ] ]
- ;
END;
value loc = (0, 0);
diff --git a/camlp4/ocaml_src/meta/pa_extend.ml b/camlp4/ocaml_src/meta/pa_extend.ml
index 74b381f49..b42afc41b 100644
--- a/camlp4/ocaml_src/meta/pa_extend.ml
+++ b/camlp4/ocaml_src/meta/pa_extend.ml
@@ -1004,11 +1004,11 @@ let sslist_aux loc min sep s =
{used = []; text = slist loc min sep s;
styp = STapp (loc, "list", s.styp)}
in
- let patt = MLast.PaLid (loc, "l") in
+ let patt = MLast.PaLid (loc, "a") in
{pattern = Some patt; symbol = symb}
in
let act =
- MLast.ExApp (loc, MLast.ExUid (loc, "List"), MLast.ExLid (loc, "l"))
+ MLast.ExApp (loc, MLast.ExUid (loc, "List"), MLast.ExLid (loc, "a"))
in
{prod = [psymb]; action = Some act}
in
@@ -1023,6 +1023,39 @@ let sslist loc min sep s =
| _ -> sslist_aux loc min sep s
;;
+let ssopt loc s =
+ let psymbol p s t =
+ let symb = {used = []; text = s; styp = t} in
+ {pattern = Some p; symbol = symb}
+ in
+ let rl =
+ let r1 =
+ let prod =
+ let n = mk_name loc (MLast.ExLid (loc, "a_opt")) in
+ [psymbol (MLast.PaLid (loc, "a")) (TXnterm (loc, n, None))
+ (STquo (loc, "a_opt"))]
+ in
+ let act = MLast.ExLid (loc, "a") in {prod = prod; action = Some act}
+ in
+ let r2 =
+ let psymb =
+ let symb =
+ {used = []; text = TXopt (loc, s.text);
+ styp = STapp (loc, "option", s.styp)}
+ in
+ let patt = MLast.PaLid (loc, "a") in
+ {pattern = Some patt; symbol = symb}
+ in
+ let act =
+ MLast.ExApp (loc, MLast.ExUid (loc, "Option"), MLast.ExLid (loc, "a"))
+ in
+ {prod = [psymb]; action = Some act}
+ in
+ [r1; r2]
+ in
+ TXrules (loc, srules loc "anti" rl "")
+;;
+
let is_global e =
function
None -> true
@@ -1619,7 +1652,9 @@ Grammar.extend
Gramext.action
(fun (s : 'symbol) _ (loc : int * int) ->
(let styp = STapp (loc, "option", s.styp) in
- let text = TXopt (loc, s.text) in
+ let text =
+ if !quotify then ssopt loc s else TXopt (loc, s.text)
+ in
{used = s.used; text = text; styp = styp} :
'symbol));
[Gramext.Stoken ("UIDENT", "LIST1"); Gramext.Sself;
diff --git a/camlp4/ocaml_src/meta/pa_extend_m.ml b/camlp4/ocaml_src/meta/pa_extend_m.ml
index 5b02c7213..96921ae2d 100644
--- a/camlp4/ocaml_src/meta/pa_extend_m.ml
+++ b/camlp4/ocaml_src/meta/pa_extend_m.ml
@@ -18,7 +18,13 @@ Grammar.extend
[Grammar.Entry.obj (symbol : 'symbol Grammar.Entry.e),
Some (Gramext.Level "top"),
[None, Some Gramext.NonA,
- [[Gramext.srules
+ [[Gramext.Stoken ("UIDENT", "SOPT"); Gramext.Sself],
+ Gramext.action
+ (fun (s : 'symbol) _ (loc : int * int) ->
+ (let used = mk_name loc (MLast.ExLid (loc, "a_opt")) :: s.used in
+ {used = used; text = ssopt loc s; styp = STlid (loc, "ast")} :
+ 'symbol));
+ [Gramext.srules
[[Gramext.Stoken ("UIDENT", "SLIST1")],
Gramext.action (fun _ (loc : int * int) -> (true : 'e__1));
[Gramext.Stoken ("UIDENT", "SLIST0")],
@@ -36,11 +42,10 @@ Grammar.extend
(loc : int * int) ->
(let used =
match sep with
- Some symb ->
- mk_name loc (MLast.ExLid (loc, "anti")) ::
- (symb.used @ s.used)
+ Some symb -> symb.used @ s.used
| None -> s.used
in
+ let used = mk_name loc (MLast.ExLid (loc, "a_list")) :: used in
{used = used; text = sslist loc min sep s;
styp = STlid (loc, "ast")} :
'symbol))]]];;
diff --git a/camlp4/ocaml_src/meta/pa_r.ml b/camlp4/ocaml_src/meta/pa_r.ml
index c492c3bd8..c80749eef 100644
--- a/camlp4/ocaml_src/meta/pa_r.ml
+++ b/camlp4/ocaml_src/meta/pa_r.ml
@@ -153,6 +153,8 @@ let mkassert loc e =
else MLast.ExIfe (loc, e, MLast.ExUid (loc, "()"), raiser)
;;
+let append_elem el e = el @ [e];;
+
(* ...suppose to flush the input in case of syntax error to avoid multiple
errors in case of cut-and-paste in the xterm, but work bad: for example
the input "for x = 1;" waits for another line before displaying the
@@ -169,11 +171,22 @@ and sync_semi cs =
Pcaml.sync.val := sync;
*)
-let type_parameter = Grammar.Entry.create gram "type_parameter";;
-let fun_binding = Grammar.Entry.create gram "fun_binding";;
let ipatt = Grammar.Entry.create gram "ipatt";;
-let direction_flag = Grammar.Entry.create gram "direction_flag";;
-let mod_ident = Grammar.Entry.create gram "mod_ident";;
+
+let not_yet_warned = ref true;;
+let warning_seq () =
+ if !not_yet_warned then
+ begin
+ not_yet_warned := false;
+ Printf.eprintf "\
+*** warning: use of old syntax
+*** type \"camlp4r -help_seq\" in a shell for explanations
+";
+ flush stderr
+ end
+;;
+Pcaml.add_option "-no_warn_seq" (Arg.Clear not_yet_warned)
+ " No warning when using old syntax for sequences.";;
Grammar.extend
(let _ = (interf : 'interf Grammar.Entry.e)
@@ -293,11 +306,7 @@ Grammar.extend
and _ = (class_sig_item : 'class_sig_item Grammar.Entry.e)
and _ = (class_str_item : 'class_str_item Grammar.Entry.e)
and _ = (let_binding : 'let_binding Grammar.Entry.e)
- and _ = (type_parameter : 'type_parameter Grammar.Entry.e)
- and _ = (fun_binding : 'fun_binding Grammar.Entry.e)
- and _ = (ipatt : 'ipatt Grammar.Entry.e)
- and _ = (direction_flag : 'direction_flag Grammar.Entry.e)
- and _ = (mod_ident : 'mod_ident Grammar.Entry.e) in
+ and _ = (ipatt : 'ipatt Grammar.Entry.e) in
let grammar_entry_create s =
Grammar.Entry.create (Grammar.of_entry sig_item) s
in
@@ -313,6 +322,8 @@ Grammar.extend
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 fun_binding : 'fun_binding Grammar.Entry.e =
+ 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 =
@@ -338,11 +349,15 @@ Grammar.extend
grammar_entry_create "type_patt"
and constrain : 'constrain Grammar.Entry.e =
grammar_entry_create "constrain"
+ and type_parameter : 'type_parameter Grammar.Entry.e =
+ grammar_entry_create "type_parameter"
and constructor_declaration : 'constructor_declaration Grammar.Entry.e =
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"
+ and mod_ident : 'mod_ident Grammar.Entry.e =
+ grammar_entry_create "mod_ident"
and class_declaration : 'class_declaration Grammar.Entry.e =
grammar_entry_create "class_declaration"
and class_fun_binding : 'class_fun_binding Grammar.Entry.e =
@@ -353,14 +368,14 @@ Grammar.extend
grammar_entry_create "class_fun_def"
and class_structure : 'class_structure Grammar.Entry.e =
grammar_entry_create "class_structure"
- and class_self_patt_opt : 'class_self_patt_opt Grammar.Entry.e =
- grammar_entry_create "class_self_patt_opt"
+ and class_self_patt : 'class_self_patt Grammar.Entry.e =
+ grammar_entry_create "class_self_patt"
and as_lident_opt : 'as_lident_opt Grammar.Entry.e =
grammar_entry_create "as_lident_opt"
and cvalue : 'cvalue Grammar.Entry.e = grammar_entry_create "cvalue"
and label : 'label Grammar.Entry.e = grammar_entry_create "label"
- and class_self_type_opt : 'class_self_type_opt Grammar.Entry.e =
- grammar_entry_create "class_self_type_opt"
+ and class_self_type : 'class_self_type Grammar.Entry.e =
+ grammar_entry_create "class_self_type"
and class_description : 'class_description Grammar.Entry.e =
grammar_entry_create "class_description"
and class_type_declaration : 'class_type_declaration Grammar.Entry.e =
@@ -380,12 +395,15 @@ Grammar.extend
grammar_entry_create "row_field"
and name_tag : 'name_tag Grammar.Entry.e = grammar_entry_create "name_tag"
and rec_flag : 'rec_flag Grammar.Entry.e = grammar_entry_create "rec_flag"
+ and direction_flag : 'direction_flag Grammar.Entry.e =
+ grammar_entry_create "direction_flag"
and mutable_flag : 'mutable_flag Grammar.Entry.e =
grammar_entry_create "mutable_flag"
and virtual_flag : 'virtual_flag Grammar.Entry.e =
grammar_entry_create "virtual_flag"
- and amp_flag : 'amp_flag Grammar.Entry.e =
- grammar_entry_create "amp_flag"
+ and amp_flag : 'amp_flag Grammar.Entry.e = grammar_entry_create "amp_flag"
+ and warning_sequence : 'warning_sequence Grammar.Entry.e =
+ grammar_entry_create "warning_sequence"
in
[Grammar.Entry.obj (module_expr : 'module_expr Grammar.Entry.e), None,
[None, None,
@@ -1797,15 +1815,16 @@ Grammar.extend
(fun _ (ct : 'class_type) _ (ce : 'class_expr) _ (loc : int * int) ->
(MLast.CeTyc (loc, ce, ct) : 'class_expr));
[Gramext.Stoken ("", "object");
- Gramext.Snterm
- (Grammar.Entry.obj
- (class_self_patt_opt : 'class_self_patt_opt Grammar.Entry.e));
+ Gramext.Sopt
+ (Gramext.Snterm
+ (Grammar.Entry.obj
+ (class_self_patt : 'class_self_patt Grammar.Entry.e)));
Gramext.Snterm
(Grammar.Entry.obj
(class_structure : 'class_structure Grammar.Entry.e));
Gramext.Stoken ("", "end")],
Gramext.action
- (fun _ (cf : 'class_structure) (cspo : 'class_self_patt_opt) _
+ (fun _ (cf : 'class_structure) (cspo : 'class_self_patt option) _
(loc : int * int) ->
(MLast.CeStr (loc, cspo, cf) : 'class_expr));
[Gramext.Snterm
@@ -1841,26 +1860,22 @@ Grammar.extend
Gramext.action
(fun (cf : 'e__6 list) (loc : int * int) ->
(cf : 'class_structure))]];
- Grammar.Entry.obj
- (class_self_patt_opt : 'class_self_patt_opt Grammar.Entry.e),
+ Grammar.Entry.obj (class_self_patt : 'class_self_patt Grammar.Entry.e),
None,
[None, None,
- [[],
- Gramext.action (fun (loc : int * int) -> (None : 'class_self_patt_opt));
- [Gramext.Stoken ("", "(");
+ [[Gramext.Stoken ("", "(");
Gramext.Snterm (Grammar.Entry.obj (patt : 'patt Grammar.Entry.e));
Gramext.Stoken ("", ":");
Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e));
Gramext.Stoken ("", ")")],
Gramext.action
(fun _ (t : 'ctyp) _ (p : 'patt) _ (loc : int * int) ->
- (Some (MLast.PaTyc (loc, p, t)) : 'class_self_patt_opt));
+ (MLast.PaTyc (loc, p, t) : 'class_self_patt));
[Gramext.Stoken ("", "(");
Gramext.Snterm (Grammar.Entry.obj (patt : 'patt Grammar.Entry.e));
Gramext.Stoken ("", ")")],
Gramext.action
- (fun _ (p : 'patt) _ (loc : int * int) ->
- (Some p : 'class_self_patt_opt))]];
+ (fun _ (p : 'patt) _ (loc : int * int) -> (p : 'class_self_patt))]];
Grammar.Entry.obj (class_str_item : 'class_str_item Grammar.Entry.e),
None,
[None, None,
@@ -1992,9 +2007,10 @@ Grammar.extend
Grammar.Entry.obj (class_type : 'class_type Grammar.Entry.e), None,
[None, None,
[[Gramext.Stoken ("", "object");
- Gramext.Snterm
- (Grammar.Entry.obj
- (class_self_type_opt : 'class_self_type_opt Grammar.Entry.e));
+ Gramext.Sopt
+ (Gramext.Snterm
+ (Grammar.Entry.obj
+ (class_self_type : 'class_self_type Grammar.Entry.e)));
Gramext.Slist0
(Gramext.srules
[[Gramext.Snterm
@@ -2006,7 +2022,7 @@ Grammar.extend
(csf : 'e__8))]);
Gramext.Stoken ("", "end")],
Gramext.action
- (fun _ (csf : 'e__8 list) (cst : 'class_self_type_opt) _
+ (fun _ (csf : 'e__8 list) (cst : 'class_self_type option) _
(loc : int * int) ->
(MLast.CtSig (loc, cst, csf) : 'class_type));
[Gramext.Snterm
@@ -2032,18 +2048,14 @@ Grammar.extend
Gramext.action
(fun (ct : 'class_type) _ _ (t : 'ctyp) _ (loc : int * int) ->
(MLast.CtFun (loc, t, ct) : 'class_type))]];
- Grammar.Entry.obj
- (class_self_type_opt : 'class_self_type_opt Grammar.Entry.e),
+ Grammar.Entry.obj (class_self_type : 'class_self_type Grammar.Entry.e),
None,
[None, None,
- [[],
- Gramext.action (fun (loc : int * int) -> (None : 'class_self_type_opt));
- [Gramext.Stoken ("", "(");
+ [[Gramext.Stoken ("", "(");
Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e));
Gramext.Stoken ("", ")")],
Gramext.action
- (fun _ (t : 'ctyp) _ (loc : int * int) ->
- (Some t : 'class_self_type_opt))]];
+ (fun _ (t : 'ctyp) _ (loc : int * int) -> (t : 'class_self_type))]];
Grammar.Entry.obj (class_sig_item : 'class_sig_item Grammar.Entry.e),
None,
[None, None,
@@ -2573,7 +2585,68 @@ Grammar.extend
[None, None,
[[], Gramext.action (fun (loc : int * int) -> (false : 'amp_flag));
[Gramext.Stoken ("", "&")],
- Gramext.action (fun _ (loc : int * int) -> (true : 'amp_flag))]]]);;
+ Gramext.action (fun _ (loc : int * int) -> (true : 'amp_flag))]];
+ Grammar.Entry.obj (expr : 'expr Grammar.Entry.e),
+ Some (Gramext.Level "top"),
+ [None, None,
+ [[Gramext.Stoken ("", "while"); Gramext.Sself; Gramext.Stoken ("", "do");
+ Gramext.Slist0
+ (Gramext.srules
+ [[Gramext.Snterm
+ (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e));
+ Gramext.Stoken ("", ";")],
+ Gramext.action
+ (fun _ (e : 'expr) (loc : int * int) -> (e : 'e__12))]);
+ Gramext.Snterm
+ (Grammar.Entry.obj
+ (warning_sequence : 'warning_sequence Grammar.Entry.e));
+ Gramext.Stoken ("", "done")],
+ Gramext.action
+ (fun _ _ (seq : 'e__12 list) _ (e : 'expr) _ (loc : int * int) ->
+ (MLast.ExWhi (loc, e, seq) : 'expr));
+ [Gramext.Stoken ("", "for"); Gramext.Stoken ("LIDENT", "");
+ Gramext.Stoken ("", "="); Gramext.Sself;
+ Gramext.Snterm
+ (Grammar.Entry.obj
+ (direction_flag : 'direction_flag Grammar.Entry.e));
+ Gramext.Sself; Gramext.Stoken ("", "do");
+ Gramext.Slist0
+ (Gramext.srules
+ [[Gramext.Snterm
+ (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e));
+ Gramext.Stoken ("", ";")],
+ Gramext.action
+ (fun _ (e : 'expr) (loc : int * int) -> (e : 'e__11))]);
+ Gramext.Snterm
+ (Grammar.Entry.obj
+ (warning_sequence : 'warning_sequence Grammar.Entry.e));
+ Gramext.Stoken ("", "done")],
+ Gramext.action
+ (fun _ _ (seq : 'e__11 list) _ (e2 : 'expr) (df : 'direction_flag)
+ (e1 : 'expr) _ (i : string) _ (loc : int * int) ->
+ (MLast.ExFor (loc, i, e1, e2, df, seq) : 'expr));
+ [Gramext.Stoken ("", "do");
+ Gramext.Slist0
+ (Gramext.srules
+ [[Gramext.Snterm
+ (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e));
+ Gramext.Stoken ("", ";")],
+ Gramext.action
+ (fun _ (e : 'expr) (loc : int * int) -> (e : 'e__10))]);
+ Gramext.Stoken ("", "return");
+ Gramext.Snterm
+ (Grammar.Entry.obj
+ (warning_sequence : 'warning_sequence Grammar.Entry.e));
+ Gramext.Sself],
+ Gramext.action
+ (fun (e : 'expr) _ _ (seq : 'e__10 list) _ (loc : int * int) ->
+ (MLast.ExSeq (loc, append_elem seq e) : 'expr))]];
+ Grammar.Entry.obj (warning_sequence : 'warning_sequence Grammar.Entry.e),
+ None,
+ [None, None,
+ [[],
+ Gramext.action
+ (fun (loc : int * int) -> (warning_seq () : 'warning_sequence))]]]);;
Grammar.extend
[Grammar.Entry.obj (expr : 'expr Grammar.Entry.e),
@@ -2634,69 +2707,3 @@ Grammar.extend
in
Pcaml.handle_patt_locate loc x :
'patt))]]];;
-
-(* Old syntax for sequences *)
-
-let not_yet_warned = ref true;;
-let warning_seq () =
- if !not_yet_warned then
- begin
- not_yet_warned := false;
- Printf.eprintf "\
-*** warning: use of old syntax
-*** type \"camlp4r -help_seq\" in a shell for explanations
-";
- flush stderr
- end
-;;
-Pcaml.add_option "-no_warn_seq" (Arg.Clear not_yet_warned)
- " No warning when using old syntax for sequences.";;
-
-Grammar.extend
- (let _ = (expr : 'expr Grammar.Entry.e)
- and _ = (direction_flag : 'direction_flag Grammar.Entry.e) in
- [Grammar.Entry.obj (expr : 'expr Grammar.Entry.e),
- Some (Gramext.Level "top"),
- [None, None,
- [[Gramext.Stoken ("", "while"); Gramext.Sself; Gramext.Stoken ("", "do");
- Gramext.Slist0
- (Gramext.srules
- [[Gramext.Snterm
- (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e));
- Gramext.Stoken ("", ";")],
- Gramext.action
- (fun _ (e : 'expr) (loc : int * int) -> (e : 'e__12))]);
- Gramext.Stoken ("", "done")],
- Gramext.action
- (fun _ (seq : 'e__12 list) _ (e : 'expr) _ (loc : int * int) ->
- (warning_seq (); MLast.ExWhi (loc, e, seq) : 'expr));
- [Gramext.Stoken ("", "for"); Gramext.Stoken ("LIDENT", "");
- Gramext.Stoken ("", "="); Gramext.Sself;
- Gramext.Snterm
- (Grammar.Entry.obj
- (direction_flag : 'direction_flag Grammar.Entry.e));
- Gramext.Sself; Gramext.Stoken ("", "do");
- Gramext.Slist0
- (Gramext.srules
- [[Gramext.Snterm
- (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e));
- Gramext.Stoken ("", ";")],
- Gramext.action
- (fun _ (e : 'expr) (loc : int * int) -> (e : 'e__11))]);
- Gramext.Stoken ("", "done")],
- Gramext.action
- (fun _ (seq : 'e__11 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");
- Gramext.Slist0
- (Gramext.srules
- [[Gramext.Snterm
- (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e));
- Gramext.Stoken ("", ";")],
- Gramext.action
- (fun _ (e : 'expr) (loc : int * int) -> (e : 'e__10))]);
- Gramext.Stoken ("", "return"); Gramext.Sself],
- Gramext.action
- (fun (e : 'expr) _ (seq : 'e__10 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 0bb3f3d2f..92aff6b94 100644
--- a/camlp4/ocaml_src/meta/q_MLast.ml
+++ b/camlp4/ocaml_src/meta/q_MLast.ml
@@ -50,6 +50,9 @@ let class_expr = Grammar.Entry.create gram "class expr";;
let class_sig_item = Grammar.Entry.create gram "class signature item";;
let class_str_item = Grammar.Entry.create gram "class structure item";;
+let ipatt = Grammar.Entry.create gram "ipatt";;
+let let_binding = Grammar.Entry.create gram "let_binding";;
+
let o2b =
function
Option (Some _) -> Bool true
@@ -155,6 +158,8 @@ let mkassert loc e =
else Node ("ExIfe", [Loc; e; Node ("ExUid", [Loc; Str "()"]); raiser])
;;
+let append_elem el e = Append (el, e);;
+
let not_yet_warned = ref true;;
let warning_seq () =
if !not_yet_warned then
@@ -178,7 +183,9 @@ Grammar.extend
and _ = (class_type : 'class_type Grammar.Entry.e)
and _ = (class_expr : 'class_expr Grammar.Entry.e)
and _ = (class_sig_item : 'class_sig_item Grammar.Entry.e)
- and _ = (class_str_item : 'class_str_item Grammar.Entry.e) in
+ and _ = (class_str_item : 'class_str_item Grammar.Entry.e)
+ and _ = (let_binding : 'let_binding Grammar.Entry.e)
+ and _ = (ipatt : 'ipatt Grammar.Entry.e) in
let grammar_entry_create s =
Grammar.Entry.create (Grammar.of_entry sig_item) s
in
@@ -193,8 +200,6 @@ Grammar.extend
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"
and fun_binding : 'fun_binding Grammar.Entry.e =
grammar_entry_create "fun_binding"
and match_case : 'match_case Grammar.Entry.e =
@@ -233,8 +238,12 @@ Grammar.extend
grammar_entry_create "class_fun_def"
and class_structure : 'class_structure Grammar.Entry.e =
grammar_entry_create "class_structure"
+ and class_self_patt : 'class_self_patt Grammar.Entry.e =
+ grammar_entry_create "class_self_patt"
and cvalue : 'cvalue Grammar.Entry.e = grammar_entry_create "cvalue"
and label : 'label Grammar.Entry.e = grammar_entry_create "label"
+ and class_self_type : 'class_self_type Grammar.Entry.e =
+ grammar_entry_create "class_self_type"
and class_description : 'class_description Grammar.Entry.e =
grammar_entry_create "class_description"
and class_type_declaration : 'class_type_declaration Grammar.Entry.e =
@@ -247,6 +256,8 @@ Grammar.extend
and row_field : 'row_field Grammar.Entry.e =
grammar_entry_create "row_field"
and name_tag : 'name_tag Grammar.Entry.e = grammar_entry_create "name_tag"
+ and warning_sequence : 'warning_sequence Grammar.Entry.e =
+ grammar_entry_create "warning_sequence"
and dir_param : 'dir_param Grammar.Entry.e =
grammar_entry_create "dir_param"
and sequence : 'sequence Grammar.Entry.e = grammar_entry_create "sequence"
@@ -256,15 +267,10 @@ Grammar.extend
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 mod_ident : 'mod_ident Grammar.Entry.e =
grammar_entry_create "mod_ident"
- and class_self_patt_opt : 'class_self_patt_opt Grammar.Entry.e =
- grammar_entry_create "class_self_patt_opt"
and as_lident_opt : 'as_lident_opt Grammar.Entry.e =
grammar_entry_create "as_lident_opt"
- and class_self_type_opt : 'class_self_type_opt Grammar.Entry.e =
- grammar_entry_create "class_self_type_opt"
and meth_list : 'meth_list Grammar.Entry.e =
grammar_entry_create "meth_list"
and clty_longident : 'clty_longident Grammar.Entry.e =
@@ -272,6 +278,7 @@ Grammar.extend
and class_longident : 'class_longident Grammar.Entry.e =
grammar_entry_create "class_longident"
and a_list : 'a_list Grammar.Entry.e = grammar_entry_create "a_list"
+ and a_opt : 'a_opt Grammar.Entry.e = grammar_entry_create "a_opt"
and a_UIDENT : 'a_UIDENT Grammar.Entry.e = grammar_entry_create "a_UIDENT"
and a_LIDENT : 'a_LIDENT Grammar.Entry.e = grammar_entry_create "a_LIDENT"
and a_INT : 'a_INT Grammar.Entry.e = grammar_entry_create "a_INT"
@@ -306,7 +313,7 @@ Grammar.extend
(fun _ (s : 'str_item) (loc : int * int) ->
(s : 'e__1))])],
Gramext.action
- (fun (l : 'e__1 list) (loc : int * int) -> (List l : 'anti));
+ (fun (a : 'e__1 list) (loc : int * int) -> (List a : 'anti));
[Gramext.Snterm
(Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))],
Gramext.action
@@ -370,8 +377,8 @@ Grammar.extend
(let_binding : 'let_binding Grammar.Entry.e)),
Gramext.Stoken ("", "and"))],
Gramext.action
- (fun (l : 'let_binding list) (loc : int * int) ->
- (List l : 'anti));
+ (fun (a : 'let_binding list) (loc : int * int) ->
+ (List a : 'anti));
[Gramext.Snterm
(Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))],
Gramext.action
@@ -387,8 +394,8 @@ Grammar.extend
(type_declaration : 'type_declaration Grammar.Entry.e)),
Gramext.Stoken ("", "and"))],
Gramext.action
- (fun (l : 'type_declaration list) (loc : int * int) ->
- (List l : 'anti));
+ (fun (a : 'type_declaration list) (loc : int * int) ->
+ (List a : 'anti));
[Gramext.Snterm
(Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))],
Gramext.action
@@ -437,7 +444,7 @@ Grammar.extend
(Gramext.Snterm
(Grammar.Entry.obj (a_STRING : 'a_STRING Grammar.Entry.e)))],
Gramext.action
- (fun (l : 'a_STRING list) (loc : int * int) -> (List l : 'anti));
+ (fun (a : 'a_STRING list) (loc : int * int) -> (List a : 'anti));
[Gramext.Snterm
(Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))],
Gramext.action
@@ -460,7 +467,7 @@ Grammar.extend
Tuple [xx1; xx2; xx3] -> xx1, xx2, xx3
| _ ->
match () with
- _ -> raise (Match_failure ("q_MLast.ml", 5775, 5791))
+ _ -> raise (Match_failure ("q_MLast.ml", 5937, 5953))
in
Node ("StExc", [Loc; c; tl; b]) :
'str_item));
@@ -476,7 +483,7 @@ Grammar.extend
(fun _ (s : 'str_item) (loc : int * int) ->
(s : 'e__2))])],
Gramext.action
- (fun (l : 'e__2 list) (loc : int * int) -> (List l : 'anti));
+ (fun (a : 'e__2 list) (loc : int * int) -> (List a : 'anti));
[Gramext.Snterm
(Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))],
Gramext.action
@@ -542,8 +549,8 @@ Grammar.extend
(with_constr : 'with_constr Grammar.Entry.e)),
Gramext.Stoken ("", "and"))],
Gramext.action
- (fun (l : 'with_constr list) (loc : int * int) ->
- (List l : 'anti));
+ (fun (a : 'with_constr list) (loc : int * int) ->
+ (List a : 'anti));
[Gramext.Snterm
(Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))],
Gramext.action
@@ -564,7 +571,7 @@ Grammar.extend
(fun _ (s : 'sig_item) (loc : int * int) ->
(s : 'e__3))])],
Gramext.action
- (fun (l : 'e__3 list) (loc : int * int) -> (List l : 'anti));
+ (fun (a : 'e__3 list) (loc : int * int) -> (List a : 'anti));
[Gramext.Snterm
(Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))],
Gramext.action
@@ -616,8 +623,8 @@ Grammar.extend
(type_declaration : 'type_declaration Grammar.Entry.e)),
Gramext.Stoken ("", "and"))],
Gramext.action
- (fun (l : 'type_declaration list) (loc : int * int) ->
- (List l : 'anti));
+ (fun (a : 'type_declaration list) (loc : int * int) ->
+ (List a : 'anti));
[Gramext.Snterm
(Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))],
Gramext.action
@@ -666,7 +673,7 @@ Grammar.extend
(Gramext.Snterm
(Grammar.Entry.obj (a_STRING : 'a_STRING Grammar.Entry.e)))],
Gramext.action
- (fun (l : 'a_STRING list) (loc : int * int) -> (List l : 'anti));
+ (fun (a : 'a_STRING list) (loc : int * int) -> (List a : 'anti));
[Gramext.Snterm
(Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))],
Gramext.action
@@ -686,7 +693,7 @@ Grammar.extend
Tuple [xx1; xx2; xx3] -> xx1, xx2, xx3
| _ ->
match () with
- _ -> raise (Match_failure ("q_MLast.ml", 7788, 7804))
+ _ -> raise (Match_failure ("q_MLast.ml", 7950, 7966))
in
Node ("SgExc", [Loc; c; tl]) :
'sig_item));
@@ -702,7 +709,7 @@ Grammar.extend
(fun _ (s : 'sig_item) (loc : int * int) ->
(s : 'e__4))])],
Gramext.action
- (fun (l : 'e__4 list) (loc : int * int) -> (List l : 'anti));
+ (fun (a : 'e__4 list) (loc : int * int) -> (List a : 'anti));
[Gramext.Snterm
(Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))],
Gramext.action
@@ -752,8 +759,8 @@ Grammar.extend
(Grammar.Entry.obj
(type_parameter : 'type_parameter Grammar.Entry.e)))],
Gramext.action
- (fun (l : 'type_parameter list) (loc : int * int) ->
- (List l : 'anti));
+ (fun (a : 'type_parameter list) (loc : int * int) ->
+ (List a : 'anti));
[Gramext.Snterm
(Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))],
Gramext.action
@@ -816,8 +823,8 @@ Grammar.extend
(match_case : 'match_case Grammar.Entry.e)),
Gramext.Stoken ("", "|"))],
Gramext.action
- (fun (l : 'match_case list) (loc : int * int) ->
- (List l : 'anti));
+ (fun (a : 'match_case list) (loc : int * int) ->
+ (List a : 'anti));
[Gramext.Snterm
(Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))],
Gramext.action
@@ -843,8 +850,8 @@ Grammar.extend
(match_case : 'match_case Grammar.Entry.e)),
Gramext.Stoken ("", "|"))],
Gramext.action
- (fun (l : 'match_case list) (loc : int * int) ->
- (List l : 'anti));
+ (fun (a : 'match_case list) (loc : int * int) ->
+ (List a : 'anti));
[Gramext.Snterm
(Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))],
Gramext.action
@@ -868,8 +875,8 @@ Grammar.extend
(match_case : 'match_case Grammar.Entry.e)),
Gramext.Stoken ("", "|"))],
Gramext.action
- (fun (l : 'match_case list) (loc : int * int) ->
- (List l : 'anti));
+ (fun (a : 'match_case list) (loc : int * int) ->
+ (List a : 'anti));
[Gramext.Snterm
(Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))],
Gramext.action
@@ -899,8 +906,8 @@ Grammar.extend
(let_binding : 'let_binding Grammar.Entry.e)),
Gramext.Stoken ("", "and"))],
Gramext.action
- (fun (l : 'let_binding list) (loc : int * int) ->
- (List l : 'anti));
+ (fun (a : 'let_binding list) (loc : int * int) ->
+ (List a : 'anti));
[Gramext.Snterm
(Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))],
Gramext.action
@@ -1239,7 +1246,7 @@ Grammar.extend
(Grammar.Entry.obj (expr : 'expr Grammar.Entry.e)),
Gramext.Stoken ("", ","))],
Gramext.action
- (fun (l : 'expr list) (loc : int * int) -> (List l : 'anti));
+ (fun (a : 'expr list) (loc : int * int) -> (List a : 'anti));
[Gramext.Snterm
(Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))],
Gramext.action
@@ -1267,8 +1274,8 @@ Grammar.extend
(label_expr : 'label_expr Grammar.Entry.e)),
Gramext.Stoken ("", ";"))],
Gramext.action
- (fun (l : 'label_expr list) (loc : int * int) ->
- (List l : 'anti));
+ (fun (a : 'label_expr list) (loc : int * int) ->
+ (List a : 'anti));
[Gramext.Snterm
(Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))],
Gramext.action
@@ -1285,8 +1292,8 @@ Grammar.extend
(label_expr : 'label_expr Grammar.Entry.e)),
Gramext.Stoken ("", ";"))],
Gramext.action
- (fun (l : 'label_expr list) (loc : int * int) ->
- (List l : 'anti));
+ (fun (a : 'label_expr list) (loc : int * int) ->
+ (List a : 'anti));
[Gramext.Snterm
(Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))],
Gramext.action
@@ -1302,7 +1309,7 @@ Grammar.extend
(Grammar.Entry.obj (expr : 'expr Grammar.Entry.e)),
Gramext.Stoken ("", ";"))],
Gramext.action
- (fun (l : 'expr list) (loc : int * int) -> (List l : 'anti));
+ (fun (a : 'expr list) (loc : int * int) -> (List a : 'anti));
[Gramext.Snterm
(Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))],
Gramext.action
@@ -1318,7 +1325,7 @@ Grammar.extend
(Grammar.Entry.obj (expr : 'expr Grammar.Entry.e)),
Gramext.Stoken ("", ";"))],
Gramext.action
- (fun (l : 'expr list) (loc : int * int) -> (List l : 'anti));
+ (fun (a : 'expr list) (loc : int * int) -> (List a : 'anti));
[Gramext.Snterm
(Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))],
Gramext.action
@@ -1391,8 +1398,8 @@ Grammar.extend
(let_binding : 'let_binding Grammar.Entry.e)),
Gramext.Stoken ("", "and"))],
Gramext.action
- (fun (l : 'let_binding list) (loc : int * int) ->
- (List l : 'anti));
+ (fun (a : 'let_binding list) (loc : int * int) ->
+ (List a : 'anti));
[Gramext.Snterm
(Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))],
Gramext.action
@@ -1538,7 +1545,7 @@ Grammar.extend
(Grammar.Entry.obj (patt : 'patt Grammar.Entry.e)),
Gramext.Stoken ("", ","))],
Gramext.action
- (fun (l : 'patt list) (loc : int * int) -> (List l : 'anti));
+ (fun (a : 'patt list) (loc : int * int) -> (List a : 'anti));
[Gramext.Snterm
(Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))],
Gramext.action
@@ -1572,8 +1579,8 @@ Grammar.extend
(label_patt : 'label_patt Grammar.Entry.e)),
Gramext.Stoken ("", ";"))],
Gramext.action
- (fun (l : 'label_patt list) (loc : int * int) ->
- (List l : 'anti));
+ (fun (a : 'label_patt list) (loc : int * int) ->
+ (List a : 'anti));
[Gramext.Snterm
(Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))],
Gramext.action
@@ -1589,7 +1596,7 @@ Grammar.extend
(Grammar.Entry.obj (patt : 'patt Grammar.Entry.e)),
Gramext.Stoken ("", ";"))],
Gramext.action
- (fun (l : 'patt list) (loc : int * int) -> (List l : 'anti));
+ (fun (a : 'patt list) (loc : int * int) -> (List a : 'anti));
[Gramext.Snterm
(Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))],
Gramext.action
@@ -1605,7 +1612,7 @@ Grammar.extend
(Grammar.Entry.obj (patt : 'patt Grammar.Entry.e)),
Gramext.Stoken ("", ";"))],
Gramext.action
- (fun (l : 'patt list) (loc : int * int) -> (List l : 'anti));
+ (fun (a : 'patt list) (loc : int * int) -> (List a : 'anti));
[Gramext.Snterm
(Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))],
Gramext.action
@@ -1715,7 +1722,7 @@ Grammar.extend
(Grammar.Entry.obj (ipatt : 'ipatt Grammar.Entry.e)),
Gramext.Stoken ("", ","))],
Gramext.action
- (fun (l : 'ipatt list) (loc : int * int) -> (List l : 'anti));
+ (fun (a : 'ipatt list) (loc : int * int) -> (List a : 'anti));
[Gramext.Snterm
(Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))],
Gramext.action
@@ -1749,8 +1756,8 @@ Grammar.extend
(label_ipatt : 'label_ipatt Grammar.Entry.e)),
Gramext.Stoken ("", ";"))],
Gramext.action
- (fun (l : 'label_ipatt list) (loc : int * int) ->
- (List l : 'anti));
+ (fun (a : 'label_ipatt list) (loc : int * int) ->
+ (List a : 'anti));
[Gramext.Snterm
(Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))],
Gramext.action
@@ -1780,8 +1787,8 @@ Grammar.extend
(Grammar.Entry.obj
(type_parameter : 'type_parameter Grammar.Entry.e)))],
Gramext.action
- (fun (l : 'type_parameter list) (loc : int * int) ->
- (List l : 'anti));
+ (fun (a : 'type_parameter list) (loc : int * int) ->
+ (List a : 'anti));
[Gramext.Snterm
(Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))],
Gramext.action
@@ -1794,7 +1801,7 @@ Grammar.extend
(Grammar.Entry.obj
(constrain : 'constrain Grammar.Entry.e)))],
Gramext.action
- (fun (l : 'constrain list) (loc : int * int) -> (List l : 'anti));
+ (fun (a : 'constrain list) (loc : int * int) -> (List a : 'anti));
[Gramext.Snterm
(Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))],
Gramext.action
@@ -1872,8 +1879,8 @@ Grammar.extend
(label_declaration : 'label_declaration Grammar.Entry.e)),
Gramext.Stoken ("", ";"))],
Gramext.action
- (fun (l : 'label_declaration list) (loc : int * int) ->
- (List l : 'anti));
+ (fun (a : 'label_declaration list) (loc : int * int) ->
+ (List a : 'anti));
[Gramext.Snterm
(Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))],
Gramext.action
@@ -1891,8 +1898,8 @@ Grammar.extend
'constructor_declaration Grammar.Entry.e)),
Gramext.Stoken ("", "|"))],
Gramext.action
- (fun (l : 'constructor_declaration list) (loc : int * int) ->
- (List l : 'anti));
+ (fun (a : 'constructor_declaration list) (loc : int * int) ->
+ (List a : 'anti));
[Gramext.Snterm
(Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))],
Gramext.action
@@ -1910,7 +1917,7 @@ Grammar.extend
(Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)),
Gramext.Stoken ("", "*"))],
Gramext.action
- (fun (l : 'ctyp list) (loc : int * int) -> (List l : 'anti));
+ (fun (a : 'ctyp list) (loc : int * int) -> (List a : 'anti));
[Gramext.Snterm
(Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))],
Gramext.action
@@ -1955,7 +1962,7 @@ Grammar.extend
(Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)),
Gramext.Stoken ("", "and"))],
Gramext.action
- (fun (l : 'ctyp list) (loc : int * int) -> (List l : 'anti));
+ (fun (a : 'ctyp list) (loc : int * int) -> (List a : 'anti));
[Gramext.Snterm
(Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))],
Gramext.action
@@ -2013,8 +2020,8 @@ Grammar.extend
'class_type_declaration Grammar.Entry.e)),
Gramext.Stoken ("", "and"))],
Gramext.action
- (fun (l : 'class_type_declaration list) (loc : int * int) ->
- (List l : 'anti));
+ (fun (a : 'class_type_declaration list) (loc : int * int) ->
+ (List a : 'anti));
[Gramext.Snterm
(Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))],
Gramext.action
@@ -2030,8 +2037,8 @@ Grammar.extend
(class_declaration : 'class_declaration Grammar.Entry.e)),
Gramext.Stoken ("", "and"))],
Gramext.action
- (fun (l : 'class_declaration list) (loc : int * int) ->
- (List l : 'anti));
+ (fun (a : 'class_declaration list) (loc : int * int) ->
+ (List a : 'anti));
[Gramext.Snterm
(Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))],
Gramext.action
@@ -2050,8 +2057,8 @@ Grammar.extend
'class_type_declaration Grammar.Entry.e)),
Gramext.Stoken ("", "and"))],
Gramext.action
- (fun (l : 'class_type_declaration list) (loc : int * int) ->
- (List l : 'anti));
+ (fun (a : 'class_type_declaration list) (loc : int * int) ->
+ (List a : 'anti));
[Gramext.Snterm
(Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))],
Gramext.action
@@ -2067,8 +2074,8 @@ Grammar.extend
(class_description : 'class_description Grammar.Entry.e)),
Gramext.Stoken ("", "and"))],
Gramext.action
- (fun (l : 'class_description list) (loc : int * int) ->
- (List l : 'anti));
+ (fun (a : 'class_description list) (loc : int * int) ->
+ (List a : 'anti));
[Gramext.Snterm
(Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))],
Gramext.action
@@ -2133,8 +2140,8 @@ Grammar.extend
(type_parameter : 'type_parameter Grammar.Entry.e)),
Gramext.Stoken ("", ","))],
Gramext.action
- (fun (l : 'type_parameter list) (loc : int * int) ->
- (List l : 'anti));
+ (fun (a : 'type_parameter list) (loc : int * int) ->
+ (List a : 'anti));
[Gramext.Snterm
(Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))],
Gramext.action
@@ -2175,8 +2182,8 @@ Grammar.extend
(let_binding : 'let_binding Grammar.Entry.e)),
Gramext.Stoken ("", "and"))],
Gramext.action
- (fun (l : 'let_binding list) (loc : int * int) ->
- (List l : 'anti));
+ (fun (a : 'let_binding list) (loc : int * int) ->
+ (List a : 'anti));
[Gramext.Snterm
(Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))],
Gramext.action
@@ -2212,16 +2219,23 @@ Grammar.extend
(fun _ (ct : 'class_type) _ (ce : 'class_expr) _ (loc : int * int) ->
(Node ("CeTyc", [Loc; ce; ct]) : 'class_expr));
[Gramext.Stoken ("", "object");
- Gramext.Snterm
- (Grammar.Entry.obj
- (class_self_patt_opt : 'class_self_patt_opt Grammar.Entry.e));
+ Gramext.srules
+ [[Gramext.Sopt
+ (Gramext.Snterm
+ (Grammar.Entry.obj
+ (class_self_patt : 'class_self_patt Grammar.Entry.e)))],
+ Gramext.action
+ (fun (a : 'class_self_patt option) (loc : int * int) ->
+ (Option a : 'anti));
+ [Gramext.Snterm
+ (Grammar.Entry.obj (a_opt : 'a_opt Grammar.Entry.e))],
+ Gramext.action (fun (a : 'a_opt) (loc : int * int) -> (a : 'anti))];
Gramext.Snterm
(Grammar.Entry.obj
(class_structure : 'class_structure Grammar.Entry.e));
Gramext.Stoken ("", "end")],
Gramext.action
- (fun _ (cf : 'class_structure) (cspo : 'class_self_patt_opt) _
- (loc : int * int) ->
+ (fun _ (cf : 'class_structure) (cspo : ast) _ (loc : int * int) ->
(Node ("CeStr", [Loc; cspo; cf]) : 'class_expr));
[Gramext.Snterm
(Grammar.Entry.obj
@@ -2239,7 +2253,7 @@ Grammar.extend
(Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)),
Gramext.Stoken ("", ","))],
Gramext.action
- (fun (l : 'ctyp list) (loc : int * int) -> (List l : 'anti));
+ (fun (a : 'ctyp list) (loc : int * int) -> (List a : 'anti));
[Gramext.Snterm
(Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))],
Gramext.action
@@ -2262,35 +2276,29 @@ Grammar.extend
(fun _ (cf : 'class_str_item) (loc : int * int) ->
(cf : 'e__6))])],
Gramext.action
- (fun (l : 'e__6 list) (loc : int * int) -> (List l : 'anti));
+ (fun (a : 'e__6 list) (loc : int * int) -> (List a : 'anti));
[Gramext.Snterm
(Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))],
Gramext.action
(fun (a : 'a_list) (loc : int * int) -> (a : 'anti))]],
Gramext.action
(fun (cf : ast) (loc : int * int) -> (cf : 'class_structure))]];
- Grammar.Entry.obj
- (class_self_patt_opt : 'class_self_patt_opt Grammar.Entry.e),
+ Grammar.Entry.obj (class_self_patt : 'class_self_patt Grammar.Entry.e),
None,
[None, None,
- [[],
- Gramext.action
- (fun (loc : int * int) -> (Option None : 'class_self_patt_opt));
- [Gramext.Stoken ("", "(");
+ [[Gramext.Stoken ("", "(");
Gramext.Snterm (Grammar.Entry.obj (patt : 'patt Grammar.Entry.e));
Gramext.Stoken ("", ":");
Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e));
Gramext.Stoken ("", ")")],
Gramext.action
(fun _ (t : 'ctyp) _ (p : 'patt) _ (loc : int * int) ->
- (Option (Some (Node ("PaTyc", [Loc; p; t]))) :
- 'class_self_patt_opt));
+ (Node ("PaTyc", [Loc; p; t]) : 'class_self_patt));
[Gramext.Stoken ("", "(");
Gramext.Snterm (Grammar.Entry.obj (patt : 'patt Grammar.Entry.e));
Gramext.Stoken ("", ")")],
Gramext.action
- (fun _ (p : 'patt) _ (loc : int * int) ->
- (Option (Some p) : 'class_self_patt_opt))]];
+ (fun _ (p : 'patt) _ (loc : int * int) -> (p : 'class_self_patt))]];
Grammar.Entry.obj (class_str_item : 'class_str_item Grammar.Entry.e),
None,
[None, None,
@@ -2344,7 +2352,7 @@ Grammar.extend
Tuple [xx1; xx2; xx3] -> xx1, xx2, xx3
| _ ->
match () with
- _ -> raise (Match_failure ("q_MLast.ml", 24554, 24570))
+ _ -> raise (Match_failure ("q_MLast.ml", 24650, 24666))
in
Node ("CrVal", [Loc; lab; mf; e]) :
'class_str_item));
@@ -2369,7 +2377,7 @@ Grammar.extend
(fun _ (s : 'class_str_item) (loc : int * int) ->
(s : 'e__7))])],
Gramext.action
- (fun (l : 'e__7 list) (loc : int * int) -> (List l : 'anti));
+ (fun (a : 'e__7 list) (loc : int * int) -> (List a : 'anti));
[Gramext.Snterm
(Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))],
Gramext.action
@@ -2446,9 +2454,17 @@ Grammar.extend
Grammar.Entry.obj (class_type : 'class_type Grammar.Entry.e), None,
[None, None,
[[Gramext.Stoken ("", "object");
- Gramext.Snterm
- (Grammar.Entry.obj
- (class_self_type_opt : 'class_self_type_opt Grammar.Entry.e));
+ Gramext.srules
+ [[Gramext.Sopt
+ (Gramext.Snterm
+ (Grammar.Entry.obj
+ (class_self_type : 'class_self_type Grammar.Entry.e)))],
+ Gramext.action
+ (fun (a : 'class_self_type option) (loc : int * int) ->
+ (Option a : 'anti));
+ [Gramext.Snterm
+ (Grammar.Entry.obj (a_opt : 'a_opt Grammar.Entry.e))],
+ Gramext.action (fun (a : 'a_opt) (loc : int * int) -> (a : 'anti))];
Gramext.srules
[[Gramext.Slist0
(Gramext.srules
@@ -2460,14 +2476,14 @@ Grammar.extend
(fun _ (csf : 'class_sig_item) (loc : int * int) ->
(csf : 'e__8))])],
Gramext.action
- (fun (l : 'e__8 list) (loc : int * int) -> (List l : 'anti));
+ (fun (a : 'e__8 list) (loc : int * int) -> (List a : 'anti));
[Gramext.Snterm
(Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))],
Gramext.action
(fun (a : 'a_list) (loc : int * int) -> (a : 'anti))];
Gramext.Stoken ("", "end")],
Gramext.action
- (fun _ (csf : ast) (cst : 'class_self_type_opt) _ (loc : int * int) ->
+ (fun _ (csf : ast) (cst : ast) _ (loc : int * int) ->
(Node ("CtSig", [Loc; cst; csf]) : 'class_type));
[Gramext.Snterm
(Grammar.Entry.obj
@@ -2485,7 +2501,7 @@ Grammar.extend
(Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)),
Gramext.Stoken ("", ","))],
Gramext.action
- (fun (l : 'ctyp list) (loc : int * int) -> (List l : 'anti));
+ (fun (a : 'ctyp list) (loc : int * int) -> (List a : 'anti));
[Gramext.Snterm
(Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))],
Gramext.action
@@ -2500,19 +2516,14 @@ Grammar.extend
Gramext.action
(fun (ct : 'class_type) _ _ (t : 'ctyp) _ (loc : int * int) ->
(Node ("CtFun", [Loc; t; ct]) : 'class_type))]];
- Grammar.Entry.obj
- (class_self_type_opt : 'class_self_type_opt Grammar.Entry.e),
+ Grammar.Entry.obj (class_self_type : 'class_self_type Grammar.Entry.e),
None,
[None, None,
- [[],
- Gramext.action
- (fun (loc : int * int) -> (Option None : 'class_self_type_opt));
- [Gramext.Stoken ("", "(");
+ [[Gramext.Stoken ("", "(");
Gramext.Snterm (Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e));
Gramext.Stoken ("", ")")],
Gramext.action
- (fun _ (t : 'ctyp) _ (loc : int * int) ->
- (Option (Some t) : 'class_self_type_opt))]];
+ (fun _ (t : 'ctyp) _ (loc : int * int) -> (t : 'class_self_type))]];
Grammar.Entry.obj (class_sig_item : 'class_sig_item Grammar.Entry.e),
None,
[None, None,
@@ -2580,7 +2591,7 @@ Grammar.extend
(fun _ (s : 'class_sig_item) (loc : int * int) ->
(s : 'e__9))])],
Gramext.action
- (fun (l : 'e__9 list) (loc : int * int) -> (List l : 'anti));
+ (fun (a : 'e__9 list) (loc : int * int) -> (List a : 'anti));
[Gramext.Snterm
(Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))],
Gramext.action
@@ -2720,7 +2731,7 @@ Grammar.extend
Tuple [xx1; xx2] -> xx1, xx2
| _ ->
match () with
- _ -> raise (Match_failure ("q_MLast.ml", 28642, 28658))
+ _ -> raise (Match_failure ("q_MLast.ml", 28698, 28714))
in
Node ("TyObj", [Loc; ml; v]) :
'ctyp));
@@ -2755,7 +2766,7 @@ Grammar.extend
Tuple [xx1; xx2] -> xx1, xx2
| _ ->
match () with
- _ -> raise (Match_failure ("q_MLast.ml", 28944, 28960))
+ _ -> raise (Match_failure ("q_MLast.ml", 29000, 29016))
in
Tuple [Cons (f, ml); v] :
'meth_list))]];
@@ -2825,7 +2836,7 @@ Grammar.extend
(Gramext.Snterm
(Grammar.Entry.obj (name_tag : 'name_tag Grammar.Entry.e)))],
Gramext.action
- (fun (l : 'name_tag list) (loc : int * int) -> (List l : 'anti));
+ (fun (a : 'name_tag list) (loc : int * int) -> (List a : 'anti));
[Gramext.Snterm
(Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))],
Gramext.action
@@ -2860,7 +2871,7 @@ Grammar.extend
(Grammar.Entry.obj (row_field : 'row_field Grammar.Entry.e)),
Gramext.Stoken ("", "|"))],
Gramext.action
- (fun (l : 'row_field list) (loc : int * int) -> (List l : 'anti));
+ (fun (a : 'row_field list) (loc : int * int) -> (List a : 'anti));
[Gramext.Snterm
(Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))],
Gramext.action
@@ -2878,7 +2889,7 @@ Grammar.extend
(Grammar.Entry.obj (row_field : 'row_field Grammar.Entry.e)),
Gramext.Stoken ("", "|"))],
Gramext.action
- (fun (l : 'row_field list) (loc : int * int) -> (List l : 'anti));
+ (fun (a : 'row_field list) (loc : int * int) -> (List a : 'anti));
[Gramext.Snterm
(Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))],
Gramext.action
@@ -2902,7 +2913,7 @@ Grammar.extend
(Grammar.Entry.obj (ctyp : 'ctyp Grammar.Entry.e)),
Gramext.Stoken ("", "&"))],
Gramext.action
- (fun (l : 'ctyp list) (loc : int * int) -> (List l : 'anti));
+ (fun (a : 'ctyp list) (loc : int * int) -> (List a : 'anti));
[Gramext.Snterm
(Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))],
Gramext.action
@@ -3191,6 +3202,90 @@ Grammar.extend
[[], Gramext.action (fun (loc : int * int) -> (Bool false : 'amp_flag));
[Gramext.Stoken ("", "&")],
Gramext.action (fun _ (loc : int * int) -> (Bool true : 'amp_flag))]];
+ Grammar.Entry.obj (expr : 'expr Grammar.Entry.e),
+ Some (Gramext.Level "top"),
+ [None, None,
+ [[Gramext.Stoken ("", "while"); Gramext.Sself; Gramext.Stoken ("", "do");
+ Gramext.srules
+ [[Gramext.Slist0
+ (Gramext.srules
+ [[Gramext.Snterm
+ (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e));
+ Gramext.Stoken ("", ";")],
+ Gramext.action
+ (fun _ (e : 'expr) (loc : int * int) -> (e : 'e__12))])],
+ Gramext.action
+ (fun (a : 'e__12 list) (loc : int * int) -> (List a : 'anti));
+ [Gramext.Snterm
+ (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))],
+ Gramext.action
+ (fun (a : 'a_list) (loc : int * int) -> (a : 'anti))];
+ Gramext.Snterm
+ (Grammar.Entry.obj
+ (warning_sequence : 'warning_sequence Grammar.Entry.e));
+ Gramext.Stoken ("", "done")],
+ Gramext.action
+ (fun _ _ (seq : ast) _ (e : 'expr) _ (loc : int * int) ->
+ (Node ("ExWhi", [Loc; e; seq]) : 'expr));
+ [Gramext.Stoken ("", "for");
+ Gramext.Snterm
+ (Grammar.Entry.obj (a_LIDENT : 'a_LIDENT Grammar.Entry.e));
+ Gramext.Stoken ("", "="); Gramext.Sself;
+ Gramext.Snterm
+ (Grammar.Entry.obj
+ (direction_flag : 'direction_flag Grammar.Entry.e));
+ Gramext.Sself; Gramext.Stoken ("", "do");
+ Gramext.srules
+ [[Gramext.Slist0
+ (Gramext.srules
+ [[Gramext.Snterm
+ (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e));
+ Gramext.Stoken ("", ";")],
+ Gramext.action
+ (fun _ (e : 'expr) (loc : int * int) -> (e : 'e__11))])],
+ Gramext.action
+ (fun (a : 'e__11 list) (loc : int * int) -> (List a : 'anti));
+ [Gramext.Snterm
+ (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))],
+ Gramext.action
+ (fun (a : 'a_list) (loc : int * int) -> (a : 'anti))];
+ Gramext.Snterm
+ (Grammar.Entry.obj
+ (warning_sequence : 'warning_sequence Grammar.Entry.e));
+ Gramext.Stoken ("", "done")],
+ Gramext.action
+ (fun _ _ (seq : ast) _ (e2 : 'expr) (df : 'direction_flag)
+ (e1 : 'expr) _ (i : 'a_LIDENT) _ (loc : int * int) ->
+ (Node ("ExFor", [Loc; i; e1; e2; df; seq]) : 'expr));
+ [Gramext.Stoken ("", "do");
+ Gramext.srules
+ [[Gramext.Slist0
+ (Gramext.srules
+ [[Gramext.Snterm
+ (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e));
+ Gramext.Stoken ("", ";")],
+ Gramext.action
+ (fun _ (e : 'expr) (loc : int * int) -> (e : 'e__10))])],
+ Gramext.action
+ (fun (a : 'e__10 list) (loc : int * int) -> (List a : 'anti));
+ [Gramext.Snterm
+ (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))],
+ Gramext.action
+ (fun (a : 'a_list) (loc : int * int) -> (a : 'anti))];
+ Gramext.Stoken ("", "return");
+ Gramext.Snterm
+ (Grammar.Entry.obj
+ (warning_sequence : 'warning_sequence Grammar.Entry.e));
+ Gramext.Sself],
+ Gramext.action
+ (fun (e : 'expr) _ _ (seq : ast) _ (loc : int * int) ->
+ (Node ("ExSeq", [Loc; append_elem seq e]) : 'expr))]];
+ Grammar.Entry.obj (warning_sequence : 'warning_sequence Grammar.Entry.e),
+ None,
+ [None, None,
+ [[],
+ Gramext.action
+ (fun (loc : int * int) -> (warning_seq () : 'warning_sequence))]];
Grammar.Entry.obj (str_item : 'str_item Grammar.Entry.e), None,
[None, None,
[[Gramext.Stoken ("", "#");
@@ -3399,28 +3494,12 @@ Grammar.extend
Gramext.action
(fun (a : string) (loc : int * int) ->
(antiquot "" loc a : 'class_type))]];
- Grammar.Entry.obj
- (class_self_patt_opt : 'class_self_patt_opt Grammar.Entry.e),
- None,
- [None, None,
- [[Gramext.Stoken ("ANTIQUOT", "opt")],
- Gramext.action
- (fun (a : string) (loc : int * int) ->
- (antiquot "opt" loc a : 'class_self_patt_opt))]];
Grammar.Entry.obj (as_lident_opt : 'as_lident_opt Grammar.Entry.e), None,
[None, None,
[[Gramext.Stoken ("ANTIQUOT", "as")],
Gramext.action
(fun (a : string) (loc : int * int) ->
(antiquot "as" loc a : 'as_lident_opt))]];
- Grammar.Entry.obj
- (class_self_type_opt : 'class_self_type_opt Grammar.Entry.e),
- None,
- [None, None,
- [[Gramext.Stoken ("ANTIQUOT", "opt")],
- Gramext.action
- (fun (a : string) (loc : int * int) ->
- (antiquot "opt" loc a : 'class_self_type_opt))]];
Grammar.Entry.obj (meth_list : 'meth_list Grammar.Entry.e), None,
[None, None,
[[Gramext.Snterm (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e));
@@ -3467,6 +3546,12 @@ Grammar.extend
Gramext.action
(fun (a : string) (loc : int * int) ->
(antiquot "list" loc a : 'a_list))]];
+ Grammar.Entry.obj (a_opt : 'a_opt Grammar.Entry.e), None,
+ [None, None,
+ [[Gramext.Stoken ("ANTIQUOT", "opt")],
+ Gramext.action
+ (fun (a : string) (loc : int * int) ->
+ (antiquot "opt" loc a : 'a_opt))]];
Grammar.Entry.obj (a_UIDENT : 'a_UIDENT Grammar.Entry.e), None,
[None, None,
[[Gramext.Stoken ("UIDENT", "")],
@@ -3591,78 +3676,7 @@ Grammar.extend
[[Gramext.Stoken ("ANTIQUOT", "opt")],
Gramext.action
(fun (a : string) (loc : int * int) ->
- (antiquot "opt" loc a : 'amp_flag))]];
- Grammar.Entry.obj (expr : 'expr Grammar.Entry.e),
- Some (Gramext.Level "top"),
- [None, None,
- [[Gramext.Stoken ("", "while"); Gramext.Sself; Gramext.Stoken ("", "do");
- Gramext.srules
- [[Gramext.Slist0
- (Gramext.srules
- [[Gramext.Snterm
- (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e));
- Gramext.Stoken ("", ";")],
- Gramext.action
- (fun _ (e : 'expr) (loc : int * int) -> (e : 'e__12))])],
- Gramext.action
- (fun (l : 'e__12 list) (loc : int * int) -> (List l : 'anti));
- [Gramext.Snterm
- (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))],
- Gramext.action
- (fun (a : 'a_list) (loc : int * int) -> (a : 'anti))];
- Gramext.Stoken ("", "done")],
- Gramext.action
- (fun _ (seq : ast) _ (e : 'expr) _ (loc : int * int) ->
- (let _ = warning_seq () in Node ("ExWhi", [Loc; e; seq]) : 'expr));
- [Gramext.Stoken ("", "for");
- Gramext.Snterm
- (Grammar.Entry.obj (a_LIDENT : 'a_LIDENT Grammar.Entry.e));
- Gramext.Stoken ("", "="); Gramext.Sself;
- Gramext.Snterm
- (Grammar.Entry.obj
- (direction_flag : 'direction_flag Grammar.Entry.e));
- Gramext.Sself; Gramext.Stoken ("", "do");
- Gramext.srules
- [[Gramext.Slist0
- (Gramext.srules
- [[Gramext.Snterm
- (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e));
- Gramext.Stoken ("", ";")],
- Gramext.action
- (fun _ (e : 'expr) (loc : int * int) -> (e : 'e__11))])],
- Gramext.action
- (fun (l : 'e__11 list) (loc : int * int) -> (List l : 'anti));
- [Gramext.Snterm
- (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))],
- Gramext.action
- (fun (a : 'a_list) (loc : int * int) -> (a : 'anti))];
- Gramext.Stoken ("", "done")],
- Gramext.action
- (fun _ (seq : ast) _ (e2 : 'expr) (df : 'direction_flag) (e1 : 'expr)
- _ (i : 'a_LIDENT) _ (loc : int * int) ->
- (let _ = warning_seq () in
- Node ("ExFor", [Loc; i; e1; e2; df; seq]) :
- 'expr));
- [Gramext.Stoken ("", "do");
- Gramext.srules
- [[Gramext.Slist0
- (Gramext.srules
- [[Gramext.Snterm
- (Grammar.Entry.obj (expr : 'expr Grammar.Entry.e));
- Gramext.Stoken ("", ";")],
- Gramext.action
- (fun _ (e : 'expr) (loc : int * int) -> (e : 'e__10))])],
- Gramext.action
- (fun (l : 'e__10 list) (loc : int * int) -> (List l : 'anti));
- [Gramext.Snterm
- (Grammar.Entry.obj (a_list : 'a_list Grammar.Entry.e))],
- Gramext.action
- (fun (a : 'a_list) (loc : int * int) -> (a : 'anti))];
- Gramext.Stoken ("", "return"); Gramext.Sself],
- Gramext.action
- (fun (e : 'expr) _ (seq : ast) _ (loc : int * int) ->
- (let _ = warning_seq () in Node ("ExSeq", [Loc; Append (seq, e)]) :
- 'expr))]]]);;
+ (antiquot "opt" loc a : 'amp_flag))]]]);;
let loc = 0, 0;;