package ppxlib
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=ffa44ef551f23b75e21dbd698a30310431381aaf140b9fe4b81c2e70a2d2c63a
sha512=cd865efc78e85d662fab3d05de7675a46252a241db44cbf13a930017c6890da5f161fbf8511b97abd9d61bffca0cb84b3adf580b55a3820afdb4a2337e9a4a63
doc/ppxlib/Ppxlib/Location/index.html
Module Ppxlib.Location
Source
Overrides 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 : Lexing.position;
loc_end : Lexing.position;
loc_ghost : bool;
}
Set the pos_fname
both in loc_start
and loc_end
. Leave the rest as is.
Set the file name and line number of the lexbuf
to be the start of the named file.
Raise a located error. Should be avoided as much as possible, in favor of error_extensionf
. See the relevant part of the tutorial.
Return the location corresponding to the last matched regular expression
Report an exception on the given formatter
Prints File "...", line ..., characters ...-...:
val error_extensionf :
loc:t ->
('a,
Format.formatter,
unit,
string Astlib.Location.loc * Astlib.Ast_500.Parsetree.payload)
format4 ->
'a
Returns 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.