UTop configuration.
Version of utop.
Add a new OCaml keyword.
Load all the given findlib packages
If true
(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
.
Changes the syntax used in utop. If the syntax is the same as the current one, it does nothing. Otherwise it loads camlp4 and setup several configuration variables.
Notes:
If true
(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))
The history used by utop. You can configure limits using the
LTerm_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;;
Name of the history file. If None
, no history will be loaded
or saved.
Maximum size of the history file. If None
(the default) the
maximum size of history
will be used.
Maximum entries to store in the history file. If None
(the
default) the maximum number of entries if history
will be
used.
The current size of the terminal. This is used only in the console UI.
at_new_command f
adds f
to the hooks executed before each
new commands.
Type of a string-location. It is composed of a start and stop offsets (in bytes).
Exception raised by a parser when it need more data.
The default parser for toplevel regions. It uses the standard ocaml parser.
parse_toplevel_phrase
is the function used to parse a phrase
typed in the toplevel.
Its arguments are:
input
: the string to parseeos_is_error
If eos_is_error
is true
and the parser reach the end of
input, then [root:Parse_failure] should be returned.
If eos_is_error
is false
and the parser reach the end of
input, the exception Need_more must be thrown.
Except for Need_more, the function must not raise any exception.
The default parser for toplevel phrases. It uses the standard ocaml parser.
The name you must use in location to let ocaml know that it is from the toplevel.
lexbuf_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
.
get_ocaml_error_message exn
returns the location and error
message for the exception exn
which must be an exception from
the compiler.
check_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.
load_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.