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 *)
|
1999-11-17 10:59:06 -08:00
|
|
|
(* en Automatique. All rights reserved. This file is distributed *)
|
|
|
|
(* under the terms of the Q Public License version 1.0. *)
|
1995-08-09 08:06:35 -07:00
|
|
|
(* *)
|
|
|
|
(***********************************************************************)
|
|
|
|
|
|
|
|
(* $Id$ *)
|
|
|
|
|
1995-07-02 09:51:07 -07:00
|
|
|
(* Error report *)
|
|
|
|
|
2000-03-06 21:02:33 -08:00
|
|
|
open Format
|
1995-07-02 09:51:07 -07:00
|
|
|
open Location
|
|
|
|
|
|
|
|
(* Report an error *)
|
|
|
|
|
2000-03-06 21:02:33 -08:00
|
|
|
let report_error ppf exn =
|
|
|
|
let report ppf = function
|
|
|
|
| Lexer.Error(err, start, stop) ->
|
|
|
|
Location.print ppf
|
|
|
|
{loc_start = start; loc_end = stop; loc_ghost = false};
|
|
|
|
Lexer.report_error ppf err
|
1997-08-22 01:55:41 -07:00
|
|
|
| Syntaxerr.Error err ->
|
2000-03-06 21:02:33 -08:00
|
|
|
Syntaxerr.report_error ppf err
|
1995-07-02 09:51:07 -07:00
|
|
|
| Env.Error err ->
|
2000-03-06 21:02:33 -08:00
|
|
|
Env.report_error ppf err
|
1995-07-02 09:51:07 -07:00
|
|
|
| Typecore.Error(loc, err) ->
|
2000-03-06 21:02:33 -08:00
|
|
|
Location.print ppf loc; Typecore.report_error ppf err
|
1995-07-02 09:51:07 -07:00
|
|
|
| Typetexp.Error(loc, err) ->
|
2000-03-06 21:02:33 -08:00
|
|
|
Location.print ppf loc; Typetexp.report_error ppf err
|
1995-07-02 09:51:07 -07:00
|
|
|
| Typedecl.Error(loc, err) ->
|
2000-03-06 21:02:33 -08:00
|
|
|
Location.print ppf loc; Typedecl.report_error ppf err
|
1995-07-02 09:51:07 -07:00
|
|
|
| Includemod.Error err ->
|
2000-03-06 21:02:33 -08:00
|
|
|
Includemod.report_error ppf err
|
1995-07-02 09:51:07 -07:00
|
|
|
| Typemod.Error(loc, err) ->
|
2000-03-06 21:02:33 -08:00
|
|
|
Location.print ppf loc; Typemod.report_error ppf err
|
1995-07-02 09:51:07 -07:00
|
|
|
| Translcore.Error(loc, err) ->
|
2000-03-06 21:02:33 -08:00
|
|
|
Location.print ppf loc; Translcore.report_error ppf err
|
1995-07-02 09:51:07 -07:00
|
|
|
| Compilenv.Error code ->
|
2000-04-21 01:13:22 -07:00
|
|
|
Compilenv.report_error ppf code
|
1995-07-02 09:51:07 -07:00
|
|
|
| Asmgen.Error code ->
|
2000-04-21 01:13:22 -07:00
|
|
|
Asmgen.report_error ppf code
|
1995-07-02 09:51:07 -07:00
|
|
|
| Asmlink.Error code ->
|
2000-04-21 01:13:22 -07:00
|
|
|
Asmlink.report_error ppf code
|
1995-07-11 11:07:53 -07:00
|
|
|
| Asmlibrarian.Error code ->
|
2000-04-21 01:13:22 -07:00
|
|
|
Asmlibrarian.report_error ppf code
|
1995-07-02 09:51:07 -07:00
|
|
|
| Sys_error msg ->
|
2000-03-06 21:02:33 -08:00
|
|
|
fprintf ppf "I/O error: %s" msg
|
1996-04-22 04:15:41 -07:00
|
|
|
| Typeclass.Error(loc, err) ->
|
2000-03-06 21:02:33 -08:00
|
|
|
Location.print ppf loc; Typeclass.report_error ppf err
|
|
|
|
| x -> fprintf ppf "@]"; raise x in
|
|
|
|
|
|
|
|
fprintf ppf "@[%a@]@." report exn
|