Module Carcass.Loc

module Loc: sig .. end
Locating text in input data.


Positions


type pos = int * int 
The type for positions. A one-based line number and and a zero-based column number. Each Unicode scalar value on a line increments column number by one.
val nil_pos : pos
nil_pos is an invalid position.
val zero_pos : pos
zero_pos is (1,0).

Ranges


type range = pos * pos 
The type for ranges. Start and stop position.
val nil_range : range
nil_range is an invalid range.
val zero_range : range
zero_range is (zero_pos, zero_pos).

Locations


type src = 
| Builtin
| Cli
| File of Fpath.t
The type for location sources.
type t = src * range 
The type for locations.
val nil : t
nil is an invalid builtin location.
val for_builtin : string -> t
for_builtin s is a builtin location for string s.
val for_cli : string -> t
for_cli s is a cli location for string s.
val for_path : ?range:range -> Fpath.t -> t
for_path ~range p is the range range (defaults to Carcass.Loc.zero_range) of p.
val pp : t Fmt.t
pp formats locations according to GNU conventions.

Traces


type trace = t list 
The type for traces. Lists of locations.
val nil_trace : trace
nil is an empty trace.
val pp_trace : trace Fmt.t
pp_trace formats traces using Carcass.Loc.pp.