let to_string x =
let (a, b) = ((x.start), (x.stop)) in
let res =
sprintf "File \"%s\", line %d, characters %d-%d" x.file_name
a.line (a.off - a.bol) (b.off - a.bol)
in
if x.start.line <> x.stop.line
then
sprintf "%s (end at line %d, character %d)" res x.stop.line
(b.off - b.bol)
else res