module Biocaml_pos: sig
.. end
File positions.
type
t = private {
|
file :string option ; |
|
line :int option ; |
|
col :int option ; |
}
exception Bad of string
exception Undefined
Raised when asking for undefined position information.
val make : ?file:string -> ?line:int -> ?col:int -> unit -> t
val f : string -> t
val l : int -> t
val fl : string -> int -> t
val lc : int -> int -> t
val flc : string -> int -> int -> t
Methods for creating a position. f
stands for file name, l
for line number, and c
for column number. The arguments required correspond to the function name. There is no fc
nor c
function because a line number is required when a column number is given.
val unknown : t
Represents an unknown position. Use sparingly.
val file_exn : t -> string
val line_exn : t -> int
val col_exn : t -> int
Return the file name, line number, or column number. Raise
Biocaml_pos.Undefined
if given position does not have requested information.
val set_file : t -> string -> t
val set_line : t -> int -> t
val set_col : t -> int -> t
Set the file name, line number, or column number. Raise Bad
if resulting t
would be ill-formed.
val incrl : t -> int -> t
incrl pos k
increments the line number of pos
by k
.
val to_string : t -> string
val t_of_sexp : Sexplib.Sexp.t -> t
val sexp_of_t : t -> Sexplib.Sexp.t
Raised when asking for undefined position information.
Methods for creating a position. f
stands for file name, l
for line number, and c
for column number. The arguments required correspond to the function name. There is no fc
nor c
function because a line number is required when a column number is given.
Represents an unknown position. Use sparingly.
Return the file name, line number, or column number. Raise Biocaml_pos.Undefined
if given position does not have requested information.
Set the file name, line number, or column number. Raise Bad
if resulting t
would be ill-formed.
incrl pos k
increments the line number of pos
by k
.
String representation of a position. Intended for human legibility, no particular format guaranteed.