#6609: export Toploop.phrase.

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15528 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
master
Alain Frisch 2014-10-13 07:17:10 +00:00
parent d45ab052be
commit 56782ae7bc
2 changed files with 6 additions and 3 deletions

View File

@ -287,7 +287,7 @@ let protect r newval body =
let use_print_results = ref true
let phrase ppf phr =
let preprocess_phrase ppf phr =
let phr =
match phr with
| Ptop_def str ->
@ -321,7 +321,7 @@ let use_file ppf wrap_mod name =
try
List.iter
(fun ph ->
let ph = phrase ppf ph in
let ph = preprocess_phrase ppf ph in
if not (execute_phrase !use_print_results ppf ph) then raise Exit)
(if wrap_mod then
parse_mod_use_file name lb
@ -447,7 +447,7 @@ let loop ppf =
Location.reset();
first_line := true;
let phr = try !parse_toplevel_phrase lb with Exit -> raise PPerror in
let phr = phrase ppf phr in
let phr = preprocess_phrase ppf phr in
Env.reset_cache_toplevel ();
ignore(execute_phrase true ppf phr)
with

View File

@ -53,6 +53,9 @@ val execute_phrase : bool -> formatter -> Parsetree.toplevel_phrase -> bool
phrase executed with no errors and [false] otherwise.
First bool says whether the values and types of the results
should be printed. Uncaught exceptions are always printed. *)
val preprocess_phrase : formatter -> Parsetree.toplevel_phrase -> Parsetree.toplevel_phrase
(* Preprocess the given toplevel phrase using regular and ppx
preprocessors. Return the updated phrase. *)
val use_file : formatter -> string -> bool
val use_silently : formatter -> string -> bool
val mod_use_file : formatter -> string -> bool