1 (***********************************************************************)
5 (* Damien Doligez, projet Moscova, INRIA Rocquencourt *)
7 (* Copyright 2003 Institut National de Recherche en Informatique et *)
8 (* en Automatique. All rights reserved. This file is distributed *)
9 (* under the terms of the Q Public License version 1.0. *)
11 (***********************************************************************)
22 let loc = ev
.ev_loc
in
23 if loc.loc_start
.pos_fname
<> ""
24 then Printf.sprintf
"file %s, line %d, characters %d-%d"
25 loc.loc_start
.pos_fname
loc.loc_start
.pos_lnum
26 (loc.loc_start
.pos_cnum
- loc.loc_start
.pos_bol
+ 1)
27 (loc.loc_end
.pos_cnum
- loc.loc_start
.pos_bol
+ 1)
29 let filename = source_of_module ev
.ev_loc
.loc_start ev
.ev_module
in
31 let (start
, line
) = line_of_pos
(get_buffer
loc.loc_start ev
.ev_module
)
32 loc.loc_start
.pos_cnum
34 Printf.sprintf
"file %s, line %d, characters %d-%d"
35 filename line
(loc.loc_start
.pos_cnum
- start
+ 1)
36 (loc.loc_end
.pos_cnum
- start
+ 1)
37 with Not_found
| Out_of_range
->
38 Printf.sprintf
"file %s, characters %d-%d"
39 filename (loc.loc_start
.pos_cnum
+ 1)
40 (loc.loc_end
.pos_cnum
+ 1)