module UTop:sig..end
val version : stringval count : int React.signalval keywords : Set.Make(String).t Pervasives.refval add_keyword : string -> unitval require : string list -> unittype ui =
| |
Console |
|||
| |
Emacs |
(* |
The user interface in use.
| *) |
val get_ui : unit -> uival hide_reserved : bool React.signaltrue (the default) identifiers starting with a '_' will be hidden from the
output. i.e. the following phrase won't produces any output:
let _x = 1
This is for hidding variables created by code generators for internal use. It can
also be set/unset by the command line options -hide-reserved and -show-reserved.
val get_hide_reserved : unit -> boolUTop.hide_reserved.val set_hide_reserved : bool -> unitUTop.hide_reserved.val topfind_verbose : bool React.signalfalse (the default) messages from findlib are hidden. This is only effective
with findlib >= 1.4.val get_topfind_verbose : unit -> boolUTop.topfind_verbose.val set_topfind_verbose : bool -> unitUTop.topfind_verbose.val topfind_log : string list React.signalval show_box : bool React.signaltrue (the default) the completion bar is displayed.val get_show_box : unit -> boolUTop.show_box.val set_show_box : bool -> unitUTop.show_box.val set_margin_function : (LTerm_geom.size -> int option) -> unitThe default is:
fun size -> Some (max 80 size.cols)
type syntax =
| |
Normal |
(* |
No camlp4.
| *) |
| |
Camlp4o |
(* |
Camlp4, original syntax.
| *) |
| |
Camlp4r |
(* |
Camlp4, revised syntax.
| *) |
val syntax : syntax React.signalCamlp4o or Camlp4r quotations
are recognized. It is modified when you type #camlp4o or
#camlp4r. At the beginning it is Normal.val get_syntax : unit -> syntaxUTop.syntax.val set_syntax : syntax -> unitNotes:
Camlp4o or Camlp4r you cannot change it again.#camlp4o is the same as calling set_syntax Camlp4o.#camlp4r is the same as calling set_syntax Camlp4r.val phrase_terminator : string React.signalval get_phrase_terminator : unit -> stringUTop.phrase_terminator.val set_phrase_terminator : string -> unitUTop.phrase_terminator.val auto_run_lwt : bool React.signaltrue (the default) toplevel lwt expressions are
automatically run with Lwt_main.run. i.e. if you type:
Lwt_io.printl "Hello, world"
this will be replaced by:
Lwt_main.run (Lwt_io.printl "Hello, world")
val get_auto_run_lwt : unit -> boolUTop.auto_run_lwt.val set_auto_run_lwt : bool -> unitUTop.auto_run_lwt.val auto_run_async : bool React.signaltrue (the default) toplevel Async expressions are
automatically run with in a separate thread with
Thread_safe.block_on_async_exn. i.e. if you type:
after (Time.Span.of_s 1.0)
this will be replaced by:
Thread_safe.block_on_async_exn (fun () -> after (Time.Span.of_s 1.0))
val get_auto_run_async : unit -> boolUTop.auto_run_async.val set_auto_run_async : bool -> unitUTop.auto_run_async.val end_and_accept_current_phrase : LTerm_read_line.action;;, add this to your
~/.ocamlinit:
#require "lambda-term";;
LTerm_read_line.bind
[ { control = false; meta = false; shift = false; code = Enter } ]
[ UTop.end_and_accept_current_phrase ]
val external_editor : string React.signalNone for default.val set_external_editor : string -> unit
val get_external_editor : unit -> stringval history : LTerm_history.tLTerm_history module.
For example if you want to limit the history to 1000 line, add these lines to your ~/.ocamlinit file:
#require "lambda-term";;
LTerm_history.set_max_entries UTop.history 1000;;
val history_file_name : string option Pervasives.refNone, no history will be loaded
or saved.val history_file_max_size : int option Pervasives.refNone (the default) the
maximum size of history will be used.val history_file_max_entries : int option Pervasives.refNone (the
default) the maximum number of entries if history will be
used.type profile =
| |
Dark |
|||
| |
Light |
(* |
Profile for colors.
| *) |
val profile : profile React.signalDark. This is used by the
default prompt to choose colors.val set_profile : profile -> unitval size : LTerm_geom.size React.signalval key_sequence : LTerm_key.t list React.signalval time : float Pervasives.refval prompt : LTerm_text.t React.signal Pervasives.refval new_command_hooks : (unit -> unit) Lwt_sequence.tval at_new_command : (unit -> unit) -> unitat_new_command f adds f to the hooks executed before each
new commands.typelocation =int * int
type 'a result =
| |
Value of |
(* |
The function succeeded and returned this value.
| *) |
| |
Error of |
(* |
The function failed. Arguments are a list of locations to
highlight in the source and an error message.
| *) |
exception Need_more
val parse_use_file : (string -> bool -> Parsetree.toplevel_phrase list result) Pervasives.ref
val parse_use_file_default : string -> bool -> Parsetree.toplevel_phrase list resultval parse_toplevel_phrase : (string -> bool -> Parsetree.toplevel_phrase result) Pervasives.refparse_toplevel_phrase is the function used to parse a phrase
typed in the toplevel.
Its arguments are:
input: the string to parseeos_is_erroreos_is_error is true and the parser reach the end of
input, then Parse_failure should be returned.
If eos_is_error is false and the parser reach the end of
input, the exception UTop.Need_more must be thrown.
Except for UTop.Need_more, the function must not raise any
exception.
val parse_toplevel_phrase_default : string -> bool -> Parsetree.toplevel_phrase resultval parse_default : (Lexing.lexbuf -> 'a) -> string -> bool -> 'a resultval input_name : stringval lexbuf_of_string : bool Pervasives.ref -> string -> Lexing.lexbuflexbuf_of_string eof str is the same as Lexing.from_string
str except that if the lexer reach the end of str then eof is
set to true.val get_message : (Format.formatter -> 'a -> unit) -> 'a -> stringget_message printer x applies printer on x and
returns everything it prints as a string.val get_ocaml_error_message : exn -> location * stringget_ocaml_error_message exn returns the location and error
message for the exception exn which must be an exception from
the compiler.val check_phrase : Parsetree.toplevel_phrase -> (location list * string) optioncheck_phrase phrase checks that phrase can be executed
without typing or compilation errors. It returns None if
phrase is OK and an error message otherwise.
If the result is None it is guaranteed that
Toploop.execute_phrase won't raise any exception.
val collect_formatters : Buffer.t -> Format.formatter list -> (unit -> 'a) -> 'acollect_formatters buf pps f executes f and redirect
everything it prints on pps to buf.val discard_formatters : Format.formatter list -> (unit -> 'a) -> 'adiscard_formatters pps f executes f, dropping everything it
prints on pps.val split_words : string -> string listval load_path : string list Pervasives.refload_path is an alias of Config.load_path, normally hidden in toplevel.
It contains the list of directories added by findlib-required packages
and #directory directives.