Module ParseLocation

module ParseLocation: sig .. end
Standard implementation of file locations.


Interface definition


module type S = Location_intf.S
An anstract module type for providing locations.

Concrete positions


type t = {
   file : string;
   start_line : int;
   start_column : int;
   stop_line : int;
   stop_column : int;
}
exception Uncaught of t * exn
exception Lexing_error of t * string
exception Syntax_error of t * string
Exceptions that may occur during parsing
val hash : t -> int
val eq : t -> t -> bool
Hash and equality
val mk : string -> int -> int -> int -> int -> t
val mk_pair : string -> int * int -> int * int -> t
val mk_pos : Lexing.position -> Lexing.position -> t
Construction functions
val pp : Buffer.t -> t -> unit
val fmt : Format.formatter -> t -> unit
val fmt_hint : Format.formatter -> t -> unit
Printing functions
val combine : t -> t -> t
LogtkPosition that spans the two given positions. The file is assumed to be the same in both case, and is chosen from one of the two positions.
val combine_list : t list -> t
N-ary version of ParseLocation.combine.
Raises Invalid_argument if the list is empty
val smaller : t -> t -> bool
smaller p1 p2 is true if p1 is included in p2, ie p1 is a sub-location of p2 (interval inclusion)

Lexbuf


val set_file : Lexing.lexbuf -> string -> unit
Change the file name used for positions in this lexbuf
val mk_lexbuf : [ `File of string | `Stdin ] -> Lexing.lexbuf
Reutnrs the lexbuf associetd with the given file or stdin, with the correct filename.
val of_lexbuf : Lexing.lexbuf -> t
Recover a position from a lexbuf