Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
30 lines (22 sloc) 631 Bytes
\section{Position}
Module [[Position]] represents a position in a file as a pair of line
number and column. An alternative representation would be the byte
offset from the beginning of a file.
<<position.mli>>=
type line = int
type column = int
type t = line * column
val to_string: t -> string
val compare: t -> t -> int
<<position.ml>>=
type line = int
type column = int
type t = line * column
let to_string (line,col) = Printf.sprintf "%04d:%04d" line col
let compare (l,c) (l',c') =
if l < l' then -1
else if l > l' then 1
else if c < c' then -1
else if c > c' then 1
else 0
@