package lambdapi

  1. Overview
  2. Docs
type point
type t
val make_point : int -> int -> point

make_point ln col creates a point with line ln and column col.

val make_interval : point -> point -> t

make_interval s e creates an interval with start s and end e. Requires the interval to be well defined (e.g with start < finish) or it will assert

val line : point -> int
val column : point -> int
val interval_start : t -> point
val interval_end : t -> point
type cmp =
  1. | Before
  2. | In
  3. | After
    (*

    in_range pt i returns Before, In or After depending on the position of the point pt relative to the interval i.

    *)

Type for the position of a cursor relative to an interval.

val in_range : point -> t -> cmp
val compare : t -> t -> int

Comparison over intervals.

An interval is considered "smaller" than another if its ending point is before the starting point of the other.

Intervals need to be well defined (i.e returned by make_interval). Two intervals are considered equal if one is included in the other. In any other case, overlapping intervals can't be compared and will throw an error.

val point_to_string : point -> string
val interval_to_string : t -> string
val translate : t -> int -> int -> t

translate i ds df returns the interval i with its starting point translated by ds and finishing point translated by df.

Will throw an error if the resulting interval is not well-defined (see make_interval). Only translates column-wise, does not modify the line coordinates of the extremity points.

OCaml

Innovation. Community. Security.