Note on the use of Lexing.position in this module. If pos_fname = "", then use !input_name instead. If pos_lnum = -1, then pos_bol = 0. Use pos_cnum and re-parse the file to get the line and character numbers. Else all fields are correct.
val input_lexbuf : Stdlib.Lexing.lexbuf optionStdlib.ref
val input_phrase_buffer : Stdlib.Buffer.t optionStdlib.ref
Toplevel-specific functions
val echo_eof : unit -> unit
val separate_new_message : Stdlib.Format.formatter -> unit
val reset : unit -> unit
Rewriting path
val rewrite_absolute_path : string -> string
rewrite absolute path to honor the BUILD_PATH_PREFIX_MAP variable (https://reproducible-builds.org/specs/build-path-prefix-map/) if it is set.
val absolute_path : string -> string
absolute_path path first makes an absolute path, s from path, prepending the current working directory if path was relative. Then s is rewritten using rewrite_absolute_path. Finally the result is normalized by eliminating instances of '.' or '..'.
Printing locations
val show_filename : string -> string
In -absname mode, return the absolute path for this filename. Otherwise, returns the filename unchanged.
val print_filename : Stdlib.Format.formatter ->string -> unit
val print_loc : Stdlib.Format.formatter ->t-> unit
val print_locs : Stdlib.Format.formatter ->t list-> unit
Toplevel-specific location highlighting
val highlight_terminfo :
Stdlib.Lexing.lexbuf ->Stdlib.Format.formatter ->t list->
unit
The hook is a unit -> report_printer and not simply a report_printer: this is useful so that it can detect the type of the output (a file, a terminal, ...) and select a printer accordingly.
val errorf :
?loc:t->?sub:msg list->('a, Stdlib.Format.formatter, unit, error)Stdlib.format4->'a
val error_of_printer :
?loc:t->?sub:msg list->(Stdlib.Format.formatter ->'a-> unit)->'a->error
val error_of_printer_file :
(Stdlib.Format.formatter ->'a-> unit)->'a->error
Automatically reporting errors for raised exceptions
val register_error_of_exn : (exn ->error option)-> unit
Each compiler module which defines a custom type of exception which can surface as a user-visible error should register a "printer" for this exception using register_error_of_exn. The result of the printer is an error value containing a location, a message, and optionally sub-messages (each of them being located as well).
val error_of_exn : exn ->[ `Ok of error| `Already_displayed ] option