package pp_loc

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

A position in a file or string.

It is abstract to provide more flexibility than Lexing.position.

  • since 2.0
type t
val of_lexing : Stdlib.Lexing.position -> t

Convert position. The filename is ignored, the offset, line, and column are potentially used so they matter.

val of_offset : int -> t

Build a position from a byte offset in the input.

val of_line_col : int -> int -> t

of_line_col line col builds the position indicating the character at column col and line line of the input. Lines and columns start at 1.

val shift : t -> int -> t

shift pos n is the position located n bytes after pos.

val to_offset : Input.t -> t -> int

to_offset input pos computes the offset in bytes corresponding to position pos within input.

val to_lexing : ?filename:string -> Input.t -> t -> Stdlib.Lexing.position

to_lexing input pos computes the full position corresponding to position pos within input input. The filename is set to filename if specified, or to a dummy value otherwise (the empty string).

OCaml

Innovation. Community. Security.