diff options
-rw-r--r-- | camlp4/meta/pa_r.ml | 13 | ||||
-rw-r--r-- | camlp4/meta/q_MLast.ml | 9 | ||||
-rw-r--r-- | camlp4/ocaml_src/meta/pa_r.ml | 21 | ||||
-rw-r--r-- | camlp4/ocaml_src/meta/q_MLast.ml | 27 |
4 files changed, 31 insertions, 39 deletions
diff --git a/camlp4/meta/pa_r.ml b/camlp4/meta/pa_r.ml index 1ec94e4ec..afd01730d 100644 --- a/camlp4/meta/pa_r.ml +++ b/camlp4/meta/pa_r.ml @@ -426,8 +426,8 @@ EXTEND ; fun_def: [ RIGHTA - [ p = ipatt; e = SELF -> <:expr< fun [ $p$ -> $e$ ] >> - | "->"; e = expr -> <:expr< $e$ >> ] ] + [ p = ipatt; e = SELF -> <:expr< fun $p$ -> $e$ >> + | "->"; e = expr -> e ] ] ; patt: [ LEFTA @@ -576,14 +576,13 @@ EXTEND | "["; tpl = LIST1 type_parameter SEP ","; "]" -> (loc, tpl) ] ] ; class_fun_def: - [ [ p = patt LEVEL "simple"; "->"; ce = class_expr -> - <:class_expr< fun $p$ -> $ce$ >> - | p = patt LEVEL "simple"; cfd = SELF -> - <:class_expr< fun $p$ -> $cfd$ >> ] ] + [ [ p = ipatt; ce = SELF -> <:class_expr< fun $p$ -> $ce$ >> + | "->"; ce = class_expr -> ce ] ] ; class_expr: [ "top" - [ "fun"; cfd = class_fun_def -> cfd + [ "fun"; p = ipatt; ce = class_fun_def -> + <:class_expr< fun $p$ -> $ce$ >> | "let"; rf = rec_flag; lb = LIST1 let_binding SEP "and"; "in"; ce = SELF -> <:class_expr< let $rec:rf$ $list:lb$ in $ce$ >> ] diff --git a/camlp4/meta/q_MLast.ml b/camlp4/meta/q_MLast.ml index 06385f4d6..6249ff20f 100644 --- a/camlp4/meta/q_MLast.ml +++ b/camlp4/meta/q_MLast.ml @@ -817,14 +817,13 @@ EXTEND Qast.Tuple [Qast.Loc; tpl] ] ] ; class_fun_def: - [ [ p = patt LEVEL "simple"; "->"; ce = class_expr -> - Qast.Node "CeFun" [Qast.Loc; p; ce] - | p = patt LEVEL "simple"; cfd = SELF -> - Qast.Node "CeFun" [Qast.Loc; p; cfd] ] ] + [ [ p = ipatt; ce = SELF -> Qast.Node "CeFun" [Qast.Loc; p; ce] + | "->"; ce = class_expr -> ce ] ] ; class_expr: [ "top" - [ "fun"; cfd = class_fun_def -> cfd + [ "fun"; p = ipatt; ce = class_fun_def -> + Qast.Node "CeFun" [Qast.Loc; p; ce] | "let"; rf = rec_flag; lb = SLIST1 let_binding SEP "and"; "in"; ce = SELF -> Qast.Node "CeLet" [Qast.Loc; rf; lb; ce] ] diff --git a/camlp4/ocaml_src/meta/pa_r.ml b/camlp4/ocaml_src/meta/pa_r.ml index f39c8768e..649084fc8 100644 --- a/camlp4/ocaml_src/meta/pa_r.ml +++ b/camlp4/ocaml_src/meta/pa_r.ml @@ -1655,19 +1655,15 @@ Grammar.extend (fun (loc : int * int) -> (loc, [] : 'class_type_parameters))]]; Grammar.Entry.obj (class_fun_def : 'class_fun_def Grammar.Entry.e), None, [None, None, - [[Gramext.Snterml - (Grammar.Entry.obj (patt : 'patt Grammar.Entry.e), "simple"); - Gramext.Sself], - Gramext.action - (fun (cfd : 'class_fun_def) (p : 'patt) (loc : int * int) -> - (MLast.CeFun (loc, p, cfd) : 'class_fun_def)); - [Gramext.Snterml - (Grammar.Entry.obj (patt : 'patt Grammar.Entry.e), "simple"); - Gramext.Stoken ("", "->"); + [[Gramext.Stoken ("", "->"); Gramext.Snterm (Grammar.Entry.obj (class_expr : 'class_expr Grammar.Entry.e))], Gramext.action - (fun (ce : 'class_expr) _ (p : 'patt) (loc : int * int) -> + (fun (ce : 'class_expr) _ (loc : int * int) -> (ce : 'class_fun_def)); + [Gramext.Snterm (Grammar.Entry.obj (ipatt : 'ipatt Grammar.Entry.e)); + Gramext.Sself], + Gramext.action + (fun (ce : 'class_fun_def) (p : 'ipatt) (loc : int * int) -> (MLast.CeFun (loc, p, ce) : 'class_fun_def))]]; Grammar.Entry.obj (class_expr : 'class_expr Grammar.Entry.e), None, [Some "top", None, @@ -1684,12 +1680,13 @@ Grammar.extend (loc : int * int) -> (MLast.CeLet (loc, rf, lb, ce) : 'class_expr)); [Gramext.Stoken ("", "fun"); + Gramext.Snterm (Grammar.Entry.obj (ipatt : 'ipatt Grammar.Entry.e)); Gramext.Snterm (Grammar.Entry.obj (class_fun_def : 'class_fun_def Grammar.Entry.e))], Gramext.action - (fun (cfd : 'class_fun_def) _ (loc : int * int) -> - (cfd : 'class_expr))]; + (fun (ce : 'class_fun_def) (p : 'ipatt) _ (loc : int * int) -> + (MLast.CeFun (loc, p, ce) : 'class_expr))]; Some "apply", Some Gramext.NonA, [[Gramext.Sself; Gramext.Snterml diff --git a/camlp4/ocaml_src/meta/q_MLast.ml b/camlp4/ocaml_src/meta/q_MLast.ml index a1b2eccab..20b6c31a6 100644 --- a/camlp4/ocaml_src/meta/q_MLast.ml +++ b/camlp4/ocaml_src/meta/q_MLast.ml @@ -2398,19 +2398,15 @@ Grammar.extend (Qast.Tuple [Qast.Loc; Qast.List []] : 'class_type_parameters))]]; Grammar.Entry.obj (class_fun_def : 'class_fun_def Grammar.Entry.e), None, [None, None, - [[Gramext.Snterml - (Grammar.Entry.obj (patt : 'patt Grammar.Entry.e), "simple"); - Gramext.Sself], - Gramext.action - (fun (cfd : 'class_fun_def) (p : 'patt) (loc : int * int) -> - (Qast.Node ("CeFun", [Qast.Loc; p; cfd]) : 'class_fun_def)); - [Gramext.Snterml - (Grammar.Entry.obj (patt : 'patt Grammar.Entry.e), "simple"); - Gramext.Stoken ("", "->"); + [[Gramext.Stoken ("", "->"); Gramext.Snterm (Grammar.Entry.obj (class_expr : 'class_expr Grammar.Entry.e))], Gramext.action - (fun (ce : 'class_expr) _ (p : 'patt) (loc : int * int) -> + (fun (ce : 'class_expr) _ (loc : int * int) -> (ce : 'class_fun_def)); + [Gramext.Snterm (Grammar.Entry.obj (ipatt : 'ipatt Grammar.Entry.e)); + Gramext.Sself], + Gramext.action + (fun (ce : 'class_fun_def) (p : 'ipatt) (loc : int * int) -> (Qast.Node ("CeFun", [Qast.Loc; p; ce]) : 'class_fun_def))]]; Grammar.Entry.obj (class_expr : 'class_expr Grammar.Entry.e), None, [Some "top", None, @@ -2436,12 +2432,13 @@ Grammar.extend (loc : int * int) -> (Qast.Node ("CeLet", [Qast.Loc; rf; lb; ce]) : 'class_expr)); [Gramext.Stoken ("", "fun"); + Gramext.Snterm (Grammar.Entry.obj (ipatt : 'ipatt Grammar.Entry.e)); Gramext.Snterm (Grammar.Entry.obj (class_fun_def : 'class_fun_def Grammar.Entry.e))], Gramext.action - (fun (cfd : 'class_fun_def) _ (loc : int * int) -> - (cfd : 'class_expr))]; + (fun (ce : 'class_fun_def) (p : 'ipatt) _ (loc : int * int) -> + (Qast.Node ("CeFun", [Qast.Loc; p; ce]) : 'class_expr))]; Some "apply", Some Gramext.NonA, [[Gramext.Sself; Gramext.Snterml @@ -2601,7 +2598,7 @@ Grammar.extend Qast.Tuple [xx1; xx2; xx3] -> xx1, xx2, xx3 | _ -> match () with - _ -> raise (Match_failure ("q_MLast.ml", 32506, 32522)) + _ -> raise (Match_failure ("q_MLast.ml", 32464, 32480)) in Qast.Node ("CrVal", [Qast.Loc; lab; mf; e]) : 'class_str_item)); @@ -2996,7 +2993,7 @@ Grammar.extend Qast.Tuple [xx1; xx2] -> xx1, xx2 | _ -> match () with - _ -> raise (Match_failure ("q_MLast.ml", 37073, 37089)) + _ -> raise (Match_failure ("q_MLast.ml", 37031, 37047)) in Qast.Node ("TyObj", [Qast.Loc; ml; v]) : 'ctyp)); @@ -3031,7 +3028,7 @@ Grammar.extend Qast.Tuple [xx1; xx2] -> xx1, xx2 | _ -> match () with - _ -> raise (Match_failure ("q_MLast.ml", 37420, 37436)) + _ -> raise (Match_failure ("q_MLast.ml", 37378, 37394)) in Qast.Tuple [Qast.Cons (f, ml); v] : 'meth_list))]]; |