Implement -dparsetree and -dsource options (refs #51).

This commit is contained in:
Peter Zotov 2014-05-02 19:43:30 +04:00
parent 72a7e7bfbe
commit 0c745bcef5
1 changed files with 4 additions and 0 deletions

View File

@ -585,6 +585,8 @@ let rec loop term =
#if ocaml_version > (4, 00, 1)
Env.reset_cache_toplevel ();
#endif
if !Clflags.dump_parsetree then Printast.top_phrase pp phrase;
if !Clflags.dump_source then Pprintast.top_phrase pp phrase;
ignore (Toploop.execute_phrase true pp phrase);
(* Flush everything. *)
Format.pp_print_flush Format.std_formatter ();
@ -1169,6 +1171,8 @@ let args = Arg.align [
" Disable autoloading of files in $OCAML_TOPLEVEL_PATH/autoload";
"-require", Arg.String (fun s -> preload := `Packages (UTop.split_words s) :: !preload),
"<package> Load this package";
"-dparsetree", Arg.Set Clflags.dump_parsetree, " Dump OCaml AST after rewriting";
"-dsource", Arg.Set Clflags.dump_source, " Dump OCaml source after rewriting";
]
#if ocaml_version >= (4, 01, 0)