package lambdapi
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=d01e5f13db2eaba6e4fe330667149e0059d4886c651ff9d6b672db2dfc9765ed
sha512=33b68c972aca37985ed73c527076198e7d4961c7e27c89cdabfe4d1cff97cd41ccfb85ae9499eb98ad9a0aefd920bc55555df6393fc441ac2429e4d99cddafa8
doc/lambdapi.common/Common/Pos/index.html
Module Common.Pos
Source
Positions in Lambdapi files.
type pos = {
fname : string option;
(*File name for the position.
*)start_line : int;
(*Line number of the starting point.
*)start_col : int;
(*Column number (utf8) of the starting point.
*)end_line : int;
(*Line number of the ending point.
*)end_col : int;
(*Column number (utf8) of the ending point.
*)
}
Type of a position, corresponding to a continuous range of characters in a (utf8-encoded) source.
Total comparison function on pos.
type 'a loc = {
elt : 'a;
(*The element that is being localised.
*)pos : popt;
(*Position of the element in the source code.
*)
}
Type constructor extending a type (e.g. a piece of abstract syntax) with a a source code position.
none elt
wraps elt
in a 'a loc
structure without any specific source code position.
to_string ?print_fname pos
transforms pos
into a readable string. If print_fname
is true
(the default), the filename contained in pos
is printed.
pp ppf pos
prints the optional position pos
on ppf
.
short ppf pos
prints the optional position pos
on ppf
.
map f loc
applies function f
on the value of loc
and keeps the position unchanged.
locate ?fname loc
converts the pair of position loc
and filename fname
of the Lexing library into a pos
.
make_pos lps elt
creates a located element from the lexing positions lps
and the element elt
.
val print_file_contents :
escape:(string -> string) ->
delimiters:(string * string) ->
popt Lplib.Base.pp
print_file_contents escape sep delimiters pos
prints the contents of the file at position pos
. sep
is the separator replacing each newline (e.g. "<br>\n"). delimiters
is a pair of delimiters used to wrap the "unknown location" message returned when the position does not refer to a file. escape
is used to escape the file contents.