camlspotter avatar camlspotter committed ebe9a36

p4 support for open*

Comments (0)

Files changed (4)

camlp4/Camlp4/Camlp4Ast.partial.ml

     | StMty of loc and string and module_type
       (* open i *)
     | StOpn of loc and ident
+      (* open * i *)
+    | StOpnStar of loc and ident
       (* type t *)
     | StTyp of loc and ctyp
       (* value (rec)? bi *)

camlp4/Camlp4/Struct/Camlp4Ast2OCamlAst.ml

     | StMty loc n mt -> [mkstr loc (Pstr_modtype n (module_type mt)) :: l]
     | StOpn loc id ->
         [mkstr loc (Pstr_open (long_uident id)) :: l]
+    | StOpnStar loc id ->
+        [mkstr loc (Pstr_open_overload (long_uident id)) :: l]
     | StTyp loc tdl -> [mkstr loc (Pstr_type (mktype_decl tdl [])) :: l]
     | StVal loc rf bi ->
         [mkstr loc (Pstr_value (mkrf rf) (binding bi [])) :: l]

camlp4/Camlp4Parsers/Camlp4OCamlRevisedParser.ml

         | "module"; "type"; i = a_ident; "="; mt = module_type ->
             <:str_item< module type $i$ = $mt$ >>
         | "open"; i = module_longident -> <:str_item< open $i$ >>
+        | "open"; "*"; i = module_longident -> Ast.StOpnStar(_loc, i) (* <:str_item< open * $i$ >> *)
         | "type"; td = type_declaration ->
             <:str_item< type $td$ >>
         | value_let; r = opt_rec; bi = binding ->

camlp4/boot/Camlp4.ml

           StMty of loc * string * module_type
           | (* open i *)
           StOpn of loc * ident
+          | (* open * i *)
+          StOpnStar of loc * ident
           | (* type t *)
           StTyp of loc * ctyp
           | (* value (rec)? bi *)
           | StRecMod of loc * module_binding
           | StMty of loc * string * module_type
           | StOpn of loc * ident
+          | StOpnStar of loc * ident
           | StTyp of loc * ctyp
           | StVal of loc * rec_flag * binding
           | StAnt of loc * string
                                          (Ast.IdUid (_loc, "StOpn")))))),
                                    (meta_loc _loc x0))),
                                 (meta_ident _loc x1))
+                          | Ast.StOpnStar (x0, x1) ->
+                              Ast.ExApp (_loc,
+                                (Ast.ExApp (_loc,
+                                   (Ast.ExId (_loc,
+                                      (Ast.IdAcc (_loc,
+                                         (Ast.IdUid (_loc, "Ast")),
+                                         (Ast.IdUid (_loc, "StOpnSar")))))),
+                                   (meta_loc _loc x0))),
+                                (meta_ident _loc x1))
                           | Ast.StMty (x0, x1, x2) ->
                               Ast.ExApp (_loc,
                                 (Ast.ExApp (_loc,
                                          (Ast.IdUid (_loc, "StOpn")))))),
                                    (meta_loc _loc x0))),
                                 (meta_ident _loc x1))
+                          | Ast.StOpnStar (x0, x1) ->
+                              Ast.PaApp (_loc,
+                                (Ast.PaApp (_loc,
+                                   (Ast.PaId (_loc,
+                                      (Ast.IdAcc (_loc,
+                                         (Ast.IdUid (_loc, "Ast")),
+                                         (Ast.IdUid (_loc, "StOpnStar")))))),
+                                   (meta_loc _loc x0))),
+                                (meta_ident _loc x1))
                           | Ast.StMty (x0, x1, x2) ->
                               Ast.PaApp (_loc,
                                 (Ast.PaApp (_loc,
                   | StOpn (_x, _x_i1) ->
                       let _x = o#loc _x in
                       let _x_i1 = o#ident _x_i1 in StOpn (_x, _x_i1)
+                  | StOpnStar (_x, _x_i1) ->
+                      let _x = o#loc _x in
+                      let _x_i1 = o#ident _x_i1 in StOpnStar (_x, _x_i1)
                   | StTyp (_x, _x_i1) ->
                       let _x = o#loc _x in
                       let _x_i1 = o#ctyp _x_i1 in StTyp (_x, _x_i1)
                       let o = o#module_type _x_i2 in o
                   | StOpn (_x, _x_i1) ->
                       let o = o#loc _x in let o = o#ident _x_i1 in o
+                  | StOpnStar (_x, _x_i1) ->
+                      let o = o#loc _x in let o = o#ident _x_i1 in o
                   | StTyp (_x, _x_i1) ->
                       let o = o#loc _x in let o = o#ctyp _x_i1 in o
                   | StVal (_x, _x_i1, _x_i2) ->
                   (mkstr loc (Pstr_modtype (n, (module_type mt)))) :: l
               | StOpn (loc, id) ->
                   (mkstr loc (Pstr_open (long_uident id))) :: l
+              | StOpnStar (loc, id) ->
+                  (mkstr loc (Pstr_open_overload (long_uident id))) :: l
               | StTyp (loc, tdl) ->
                   (mkstr loc (Pstr_type (mktype_decl tdl []))) :: l
               | StVal (loc, rf, bi) ->
                             o#module_type mt semisep
                       | Ast.StOpn (_, sl) ->
                           pp f "@[<2>open@ %a%(%)@]" o#ident sl semisep
+                      | Ast.StOpnStar (_, sl) ->
+                          pp f "@[<2>open*@ %a%(%)@]" o#ident sl semisep
                       | Ast.StTyp (_, t) ->
                           pp f "@[<hv0>@[<hv2>type %a@]%(%)@]" o#ctyp t
                             semisep
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.