Module Js_parser.Loc

type position = {
  1. line : int;
  2. column : int;
}
val equal_position : position -> position -> bool
type t = {
  1. source : File_key.t option;
  2. start : position;
  3. _end : position;
}
val none : t
val is_none : t -> bool
val is_none_ignore_source : t -> bool
val btwn : t -> t -> t
val char_before : t -> t
val first_char : t -> t
val contains : t -> t -> bool

contains loc1 loc2 returns true if loc1 entirely overlaps loc2

val intersects : t -> t -> bool

intersects loc1 loc2 returns true if loc1 intersects loc2 at all

val lines_intersect : t -> t -> bool

lines_intersect loc1 loc2 returns true if loc1 and loc2 cover any part of the same line, even if they don't actually intersect.

For example, if loc1 ends and then loc2 begins later on the same line, intersects loc1 loc2 is false, but lines_intersect loc1 loc2 is true.

val pos_cmp : position -> position -> int
val span_compare : t -> t -> int
val compare_ignore_source : t -> t -> int
val compare : t -> t -> int
val equal : t -> t -> bool
val debug_to_string : ?include_source:bool -> t -> string
val to_string_no_source : t -> string
val mk_loc : ?source:File_key.t -> (int * int) -> (int * int) -> t
val source : t -> File_key.t option
val cursor : File_key.t option -> int -> int -> t

Produces a zero-width Loc.t, where start = end

val start_loc : t -> t
val end_loc : t -> t