package lambdapi

All checked builds pass
  1. Overview
  2. Docs
Proof assistant for the λΠ-calculus modulo rewriting

Install

dune-project
 Dependency

Authors

Maintainers

Sources

lambdapi-4.0.0.tbz
sha256=0e2e73e0ea0c674f1263bf85ed3453ed3d6084d38eea29974a03ba9e382d29d7
sha512=2831db57fcd09206687a92fc9ee7d363e87bcec5167949e9c8161d41c63d5887b9f3556bfd63a7a9a0c12e5a5dc61a397baf4f496ebdb2a2fce122142c05e7a1

doc/lambdapi.common/Common/Pos/index.html

Module Common.PosSource

Positions in Lambdapi files.

Sourceval cur_dir : string
Sourcetype pos = {
  1. fname : string option;
    (*

    File name for the position.

    *)
  2. start_line : int;
    (*

    Line number of the starting point.

    *)
  3. start_col : int;
    (*

    Column number (utf8) of the starting point.

    *)
  4. start_offset : int;
    (*

    Number of chars since the beginning of the document for the starting point

    *)
  5. end_line : int;
    (*

    Line number of the ending point.

    *)
  6. end_col : int;
    (*

    Column number (utf8) of the ending point.

    *)
  7. end_offset : int;
    (*

    Number of chars since the beginning of the document for the ending point

    *)
}

Type of a position, corresponding to a continuous range of characters in a (utf8-encoded) source.

Total comparison function on pos.

Sourceval file_start : string -> pos

file_start fname is a zero-length position at the start of file fname, used as a fallback for error reporting when no finer position is known.

Sourceval locate : ?fname:??? -> (Lexing.position * Lexing.position) -> pos

locate ?fname (p1,p2) converts the pair of Lexing positions p1,p2 and filename fname into a pos.

Sourceval lexing : pos -> Lexing.position

lexing p converts a pos into a Lexing.position.

Sourceval to_string : ?print_dirname:??? -> ?print_fname:??? -> pos -> string

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.

Sourcetype popt = pos option

Type of optional positions.

Sourceval equal : popt -> popt -> bool

equal p1 p2 tells whether p1 and p2 denote the same position.

Sourceval pos_end : popt -> popt

pos_end po creates a position from the end of position po.

Sourceval cat : popt -> popt -> popt

cat extends and hide the above cat function from pos to popt.

Sourceval prefix : int -> popt -> popt

prefix n p is the sub-position of p covering only its first n characters, which are assumed to lie on the first line of p and to be ASCII (so that n is both a column count and a character count).

Sourceval shift : int -> popt -> popt

shift k p returns a position that is k characters after p. /!\ The generated position may not actually exist in the user input. The fields start_offset, end_offset and end_col are inconsistent.

Sourceval lexing_opt : popt -> Lexing.position

lexing_opt p converts a popt into a Lexing.position.

Sourcetype 'a loc = {
  1. elt : 'a;
    (*

    The element that is being localised.

    *)
  2. pos : popt;
    (*

    Position of the element in the source code.

    *)
}

Type constructor extending a type (e.g. a piece of abstract syntax) with a an optional source code position.

Sourcetype strloc = string loc

Localised string type (widely used).

Sourceval make : popt -> 'a -> 'a loc

make pos elt associates the position pos to elt.

Sourceval none : 'a -> 'a loc

none elt wraps elt in a 'a loc structure without any specific source code position.

Sourceval map : ('a -> 'b) -> 'a loc -> 'b loc

map f loc applies function f on the value of loc and keeps the position unchanged.

Sourceval in_pos : pos -> 'a -> 'a loc

in_pos pos elt associates the position pos to elt.

Sourceval make_pos : (Lexing.position * Lexing.position) -> 'a -> 'a loc

make_pos lps elt creates a located element from the lexing positions lps and the element elt.

Sourceval popt_to_string : ?print_dirname:??? -> ?print_fname:??? -> popt -> string

pp ppf pos prints the optional position pos on ppf.

short ppf pos prints the optional position pos on ppf.

pp_lexing ppf lps prints the Lexing.position pair lps on ppf.

Sourceval print_file_contents : parse_file:(string -> (unit -> string) * (unit -> unit)) -> escape:(string -> string) -> delimiters:(string * string) -> complain_if_location_unknown:bool -> popt Lplib.Base.pp

print_file_contents parse_file escape sep delimiters pos prints the contents of the file at position pos. The parse_file function takes in input pos.fname (that in reality may be a filename or a URI, e.g. when the text comes from LSP) and it returns both a stream of lines provided by a function that raises End_of_file if the file content is terminated, and a function to close the resources when we are done with the stream. 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.

The value -1 for end_col is to be interpreted as "at the end of line".