Ppxlib.LocationOverrides the Location module of OCaml
There are less functions in this module. However the API should be more stable than the Location module of OCaml.
For a detailled presentation of good practices regarding locations, refer to the section in the manual.
type t = Astlib.Location.t = {loc_start : Stdlib.Lexing.position;loc_end : Stdlib.Lexing.position;loc_ghost : bool;}val in_file : string -> tReturn an empty ghost range located in a given file.
Set the pos_fname both in loc_start and loc_end. Leave the rest as is.
val none : tAn arbitrary value of type t; describes an empty ghost range.
val init : Stdlib.Lexing.lexbuf -> string -> unitSet the file name and line number of the lexbuf to be the start of the named file.
val raise_errorf :
?loc:t ->
('a, Stdlib.Format.formatter, unit, 'b) format4 ->
'aRaise a located error. Should be avoided as much as possible, in favor of error_extensionf. See the relevant part of the tutorial.
val of_lexbuf : Stdlib.Lexing.lexbuf -> tReturn the location corresponding to the last matched regular expression
val report_exception : Stdlib.Format.formatter -> exn -> unitReport an exception on the given formatter
val print : Stdlib.Format.formatter -> t -> unitPrints File "...", line ..., characters ...-...:
val compare_pos : Stdlib.Lexing.position -> Stdlib.Lexing.position -> intval min_pos :
Stdlib.Lexing.position ->
Stdlib.Lexing.position ->
Stdlib.Lexing.positionval max_pos :
Stdlib.Lexing.position ->
Stdlib.Lexing.position ->
Stdlib.Lexing.positionmodule Error : sig ... endval error_extensionf :
loc:t ->
('a,
Stdlib.Format.formatter,
unit,
string Astlib.Location.loc * Astlib.Ast_500.Parsetree.payload)
format4 ->
'aReturns an error extension node. When encountered in the AST, the compiler recognizes it and displays the error properly.
For a detailed explanation on error reporting, refer to the relevant part of the tutorial.
exception Error of Error.t