1995-08-09 08:06:35 -07:00
|
|
|
(***********************************************************************)
|
|
|
|
(* *)
|
1996-04-30 07:53:58 -07:00
|
|
|
(* Objective Caml *)
|
1995-08-09 08:06:35 -07:00
|
|
|
(* *)
|
|
|
|
(* Xavier Leroy, projet Cristal, INRIA Rocquencourt *)
|
|
|
|
(* *)
|
1996-04-30 07:53:58 -07:00
|
|
|
(* Copyright 1996 Institut National de Recherche en Informatique et *)
|
1995-08-09 08:06:35 -07:00
|
|
|
(* Automatique. Distributed only by permission. *)
|
|
|
|
(* *)
|
|
|
|
(***********************************************************************)
|
|
|
|
|
|
|
|
(* $Id$ *)
|
|
|
|
|
1995-05-04 03:15:53 -07:00
|
|
|
(* Error report *)
|
|
|
|
|
|
|
|
open Format
|
|
|
|
open Location
|
|
|
|
|
|
|
|
(* Report an error *)
|
|
|
|
|
|
|
|
let report_error exn =
|
|
|
|
open_hovbox 0;
|
|
|
|
begin match exn with
|
|
|
|
Lexer.Error(err, start, stop) ->
|
|
|
|
Location.print {loc_start = start; loc_end = stop};
|
|
|
|
Lexer.report_error err
|
|
|
|
| Parse.Error(start, stop) ->
|
|
|
|
Location.print {loc_start = start; loc_end = stop};
|
|
|
|
print_string "Syntax error"
|
|
|
|
| Env.Error err ->
|
|
|
|
Env.report_error err
|
|
|
|
| Typecore.Error(loc, err) ->
|
|
|
|
Location.print loc; Typecore.report_error err
|
|
|
|
| Typetexp.Error(loc, err) ->
|
|
|
|
Location.print loc; Typetexp.report_error err
|
|
|
|
| Typedecl.Error(loc, err) ->
|
|
|
|
Location.print loc; Typedecl.report_error err
|
|
|
|
| Includemod.Error err ->
|
|
|
|
Includemod.report_error err
|
|
|
|
| Typemod.Error(loc, err) ->
|
|
|
|
Location.print loc; Typemod.report_error err
|
|
|
|
| Translcore.Error(loc, err) ->
|
|
|
|
Location.print loc; Translcore.report_error err
|
|
|
|
| Symtable.Error code ->
|
|
|
|
Symtable.report_error code
|
1995-07-02 09:45:41 -07:00
|
|
|
| Bytelink.Error code ->
|
|
|
|
Bytelink.report_error code
|
1995-07-11 11:07:53 -07:00
|
|
|
| Bytelibrarian.Error code ->
|
|
|
|
Bytelibrarian.report_error code
|
1995-05-04 03:15:53 -07:00
|
|
|
| Sys_error msg ->
|
|
|
|
print_string "I/O error: "; print_string msg
|
1996-04-22 04:15:41 -07:00
|
|
|
| Typeclass.Error(loc, err) ->
|
|
|
|
Location.print loc; Typeclass.report_error err
|
1995-05-04 03:15:53 -07:00
|
|
|
| x ->
|
|
|
|
close_box(); raise x
|
|
|
|
end;
|
|
|
|
close_box(); print_newline()
|