|
|
@@ -316,6 +316,22 @@ let const_type = function
|
|
|
| IntVal _ -> Int
|
|
|
| FloatVal _ -> Float
|
|
|
|
|
|
+(*
|
|
|
+let get_line str n =
|
|
|
+ let rec find_start from = function
|
|
|
+ | n when n < 1 -> raise (Invalid_argument "n")
|
|
|
+ | 1 -> from
|
|
|
+ | n -> find_start ((String.index_from str from '\n') + 1) (n - 1)
|
|
|
+ in
|
|
|
+ let linestart = find_start 0 n in
|
|
|
+ let len = String.length str in
|
|
|
+ let lineend =
|
|
|
+ try String.index_from str linestart '\n'
|
|
|
+ with Not_found -> len
|
|
|
+ in
|
|
|
+ String.sub str linestart (lineend - linestart)
|
|
|
+*)
|
|
|
+
|
|
|
let prerr_loc (fname, ystart, yend, xstart, xend) =
|
|
|
let file = open_in fname in
|
|
|
|
|
|
@@ -353,7 +369,9 @@ let prerr_loc_msg loc msg =
|
|
|
);
|
|
|
eprintf "%s\n" msg;
|
|
|
|
|
|
- if args.verbose >= 1 && loc != noloc then prerr_loc loc
|
|
|
+ if args.verbose >= 1 && loc != noloc then
|
|
|
+ try prerr_loc loc
|
|
|
+ with Sys_error _ -> ()
|
|
|
);
|
|
|
()
|
|
|
|