-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy patherror.ml
50 lines (40 loc) · 1.02 KB
/
error.ml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
(* Copyright 2005 INRIA *)
Version.add "$Id$";;
open Printf;;
let warnings_flag = ref true;;
let got_warning = ref false;;
let err_file = ref "";;
let print_header = ref false;;
let header = ref "";;
let set_header msg =
print_header := true;
header := msg;
;;
let err_oc = ref stderr;;
let err_inited = ref false;;
let print kind msg =
if not !err_inited then begin
if !err_file <> "" then err_oc := open_out !err_file;
if !print_header then fprintf !err_oc "%s\n" !header;
err_inited := true;
end;
fprintf !err_oc "%s%s\n" kind msg;
flush !err_oc;
;;
let warn msg =
if !warnings_flag then begin
print "Zenon warning: " msg;
got_warning := true;
end;
;;
let err msg = print "Zenon error: " msg;;
let errpos pos msg =
let s = sprintf "File \"%s\", line %d, character %d:"
pos.Lexing.pos_fname pos.Lexing.pos_lnum
(pos.Lexing.pos_cnum - pos.Lexing.pos_bol)
in
print "" s;
print "Zenon error: " msg;
;;
exception Lex_error of string;;
exception Abort;;