package loc

  1. Overview
  2. Docs
type t = int

Number of bytes from the beginning of the input. The first byte has offset 0. Such offset is named pos_cnum in the Lexing.position terminology.

val equal : t -> t -> bool
val sexp_of_t : t -> Sexplib0.Sexp.t
val of_position : Lexing.position -> t

Reading the pos_cnum of a lexing position.

val to_position : t -> file_cache:File_cache.t -> Lexing.position

Rebuild the position from a file at the given offset. Raises Invalid_argument if offset < 0 or if offset > file.length. The end-of-file position file.length is purposely allowed in order for the resulting position to be used as stop value for a range covering the file until its last character (which may occasionally be useful).

OCaml

Innovation. Community. Security.