The unpac monorepo manager self-hosting as a monorepo using unpac
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

More direct style, remove the temporary file created by -pp processor right after it has been read.

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14085 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02

+54 -60
+20 -22
driver/compile.ml
··· 28 28 check_unit_name ppf sourcefile modulename; 29 29 Env.set_unit_name modulename; 30 30 let initial_env = Compmisc.initial_env () in 31 - Pparse.parse_interface ppf sourcefile 32 - (fun ast -> 33 - if !Clflags.dump_parsetree then fprintf ppf "%a@." Printast.interface ast; 34 - if !Clflags.dump_source then fprintf ppf "%a@." Pprintast.signature ast; 35 - let tsg = Typemod.transl_signature initial_env ast in 36 - if !Clflags.dump_typedtree then fprintf ppf "%a@." Printtyped.interface tsg; 37 - let sg = tsg.sig_type in 38 - if !Clflags.print_types then 39 - Printtyp.wrap_printing_env initial_env (fun () -> 40 - fprintf std_formatter "%a@." 41 - Printtyp.signature (Typemod.simplify_signature sg)); 42 - ignore (Includemod.signatures initial_env sg sg); 43 - Typecore.force_delayed_checks (); 44 - Warnings.check_fatal (); 45 - if not !Clflags.print_types then begin 46 - let sg = Env.save_signature sg modulename (outputprefix ^ ".cmi") in 47 - Typemod.save_signature modulename tsg outputprefix sourcefile 48 - initial_env sg ; 49 - end 50 - ) 31 + let ast = Pparse.parse_interface ppf sourcefile in 32 + if !Clflags.dump_parsetree then fprintf ppf "%a@." Printast.interface ast; 33 + if !Clflags.dump_source then fprintf ppf "%a@." Pprintast.signature ast; 34 + let tsg = Typemod.transl_signature initial_env ast in 35 + if !Clflags.dump_typedtree then fprintf ppf "%a@." Printtyped.interface tsg; 36 + let sg = tsg.sig_type in 37 + if !Clflags.print_types then 38 + Printtyp.wrap_printing_env initial_env (fun () -> 39 + fprintf std_formatter "%a@." 40 + Printtyp.signature (Typemod.simplify_signature sg)); 41 + ignore (Includemod.signatures initial_env sg sg); 42 + Typecore.force_delayed_checks (); 43 + Warnings.check_fatal (); 44 + if not !Clflags.print_types then begin 45 + let sg = Env.save_signature sg modulename (outputprefix ^ ".cmi") in 46 + Typemod.save_signature modulename tsg outputprefix sourcefile 47 + initial_env sg ; 48 + end 51 49 52 50 (* Compile a .ml file *) 53 51 ··· 76 74 Warnings.check_fatal (); 77 75 Stypes.dump (Some (outputprefix ^ ".annot")) 78 76 in 79 - try Pparse.parse_implementation ppf sourcefile comp 77 + try comp (Pparse.parse_implementation ppf sourcefile) 80 78 with x -> 81 79 Stypes.dump (Some (outputprefix ^ ".annot")); 82 80 raise x ··· 101 99 close_out oc; 102 100 Stypes.dump (Some (outputprefix ^ ".annot")) 103 101 in 104 - try Pparse.parse_implementation ppf sourcefile comp 102 + try comp (Pparse.parse_implementation ppf sourcefile) 105 103 with x -> 106 104 close_out oc; 107 105 remove_file objfile;
+19 -21
driver/optcompile.ml
··· 29 29 check_unit_name ppf sourcefile modulename; 30 30 Env.set_unit_name modulename; 31 31 let initial_env = Compmisc.initial_env () in 32 - Pparse.parse_interface ppf sourcefile 33 - (fun ast -> 34 - if !Clflags.dump_parsetree then fprintf ppf "%a@." Printast.interface ast; 35 - if !Clflags.dump_source then fprintf ppf "%a@." Pprintast.signature ast; 36 - let tsg = Typemod.transl_signature initial_env ast in 37 - if !Clflags.dump_typedtree then fprintf ppf "%a@." Printtyped.interface tsg; 38 - let sg = tsg.sig_type in 39 - if !Clflags.print_types then 40 - Printtyp.wrap_printing_env initial_env (fun () -> 41 - fprintf std_formatter "%a@." 42 - Printtyp.signature (Typemod.simplify_signature sg)); 43 - ignore (Includemod.signatures initial_env sg sg); 44 - Typecore.force_delayed_checks (); 45 - Warnings.check_fatal (); 46 - if not !Clflags.print_types then begin 47 - let sg = Env.save_signature sg modulename (outputprefix ^ ".cmi") in 48 - Typemod.save_signature modulename tsg outputprefix sourcefile 49 - initial_env sg ; 50 - end 51 - ) 32 + let ast = Pparse.parse_interface ppf sourcefile in 33 + if !Clflags.dump_parsetree then fprintf ppf "%a@." Printast.interface ast; 34 + if !Clflags.dump_source then fprintf ppf "%a@." Pprintast.signature ast; 35 + let tsg = Typemod.transl_signature initial_env ast in 36 + if !Clflags.dump_typedtree then fprintf ppf "%a@." Printtyped.interface tsg; 37 + let sg = tsg.sig_type in 38 + if !Clflags.print_types then 39 + Printtyp.wrap_printing_env initial_env (fun () -> 40 + fprintf std_formatter "%a@." 41 + Printtyp.signature (Typemod.simplify_signature sg)); 42 + ignore (Includemod.signatures initial_env sg sg); 43 + Typecore.force_delayed_checks (); 44 + Warnings.check_fatal (); 45 + if not !Clflags.print_types then begin 46 + let sg = Env.save_signature sg modulename (outputprefix ^ ".cmi") in 47 + Typemod.save_signature modulename tsg outputprefix sourcefile 48 + initial_env sg ; 49 + end 52 50 53 51 (* Compile a .ml file *) 54 52 ··· 96 94 Warnings.check_fatal (); 97 95 Stypes.dump (Some (outputprefix ^ ".annot")) 98 96 in 99 - try Pparse.parse_implementation ppf sourcefile comp 97 + try comp (Pparse.parse_implementation ppf sourcefile) 100 98 with x -> 101 99 Stypes.dump (Some (outputprefix ^ ".annot")); 102 100 remove_file objfile;
+13 -13
driver/pparse.ml
··· 142 142 Command line: %s@." cmd 143 143 144 144 145 - let parse_all parse_fun magic ppf sourcefile k = 145 + let parse_all parse_fun magic ppf sourcefile = 146 146 Location.input_name := sourcefile; 147 147 let inputfile = preprocess sourcefile in 148 - try 149 - let ast = file ppf inputfile parse_fun magic in 150 - let res = k ast in 151 - remove_preprocessed inputfile; 152 - res 153 - with exn -> 154 - remove_preprocessed inputfile; 155 - raise exn 148 + let ast = 149 + try file ppf inputfile parse_fun magic 150 + with exn -> 151 + remove_preprocessed inputfile; 152 + raise exn 153 + in 154 + remove_preprocessed inputfile; 155 + ast 156 156 157 - let parse_implementation ppf sourcefile k = 158 - parse_all Parse.implementation Config.ast_impl_magic_number ppf sourcefile k 159 - let parse_interface ppf sourcefile k = 160 - parse_all Parse.interface Config.ast_intf_magic_number ppf sourcefile k 157 + let parse_implementation ppf sourcefile = 158 + parse_all Parse.implementation Config.ast_impl_magic_number ppf sourcefile 159 + let parse_interface ppf sourcefile = 160 + parse_all Parse.interface Config.ast_intf_magic_number ppf sourcefile
+2 -4
driver/pparse.mli
··· 25 25 val report_error : formatter -> error -> unit 26 26 27 27 28 - val parse_implementation: 29 - formatter -> string -> (Parsetree.structure -> 'a) -> 'a 30 - val parse_interface: 31 - formatter -> string -> (Parsetree.signature -> 'a) -> 'a 28 + val parse_implementation: formatter -> string -> Parsetree.structure 29 + val parse_interface: formatter -> string -> Parsetree.signature