Js_of_ocaml_toplevel_common.WrappedThe result types are defined in the dependency-free msg library and re-exported here.
type warning = errortype 'a result = 'a Js_of_ocaml_toplevel_protocol.Wrapped_intf.result = include Js_of_ocaml_toplevel_protocol.Wrapped_intf.Wrapped
with type toplevel := unit
and type 'a result := 'a result
and type output := Stdlib.Format.formatterval check : unit -> ?setenv:bool -> string -> unit resultParse and typecheck a given source code
val execute :
unit ->
?ppf_code:Stdlib.Format.formatter ->
?print_outcome:bool ->
ppf_answer:Stdlib.Format.formatter ->
string ->
bool resultExecute a given source code. The evaluation stops after the first toplevel phrase (as terminated by ";;") that fails to compile or for which the evaluation raises an uncaught exception.
val use :
unit ->
?filename:string ->
?print_outcome:bool ->
ppf_answer:Stdlib.Format.formatter ->
string ->
bool resultExecute a given source code. Unlike execute, the whole buffer is parsed up front (using Toploop.parse_use_file); each resulting phrase is then typechecked and evaluated in sequence. Parse errors abort before any phrase runs.
val use_mod_string :
unit ->
?print_outcome:bool ->
ppf_answer:Stdlib.Format.formatter ->
modname:string ->
?sig_code:string ->
string ->
bool resultWrap a given source code into a module and bind it with a given name.
Discard the scratch typing environment left by check ~setenv:true, restoring the environment as it was just before that call (and thus re-enabling execute, use and use_mod_string). All definitions actually executed beforehand are kept; only the type-only definitions introduced by check ~setenv:true are dropped. A no-op when no scratch environment is active.
Build a normalized lexbuf for step from a source string. When ppf_code is given, the source is echoed to it as it is consumed. The lexbuf holds no resource beyond what the GC reclaims; there is nothing to close.
val step :
unit ->
?print_outcome:bool ->
ppf_answer:Stdlib.Format.formatter ->
Stdlib.Lexing.lexbuf ->
[ `Phrase of bool | `Eof ] resultParse, preprocess and evaluate the next toplevel phrase from the lexbuf. Returns Success (`Phrase ok) for a phrase that ran (ok is false if it raised at evaluation time, with the backtrace already on ppf_answer), Success `Eof once the buffer is exhausted, or Error on a parse/type error. The caller drives the loop and decides whether to continue after a failure.
val error_of_exn : exn -> error