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$ *)
|
|
|
|
|
2001-06-15 12:09:45 -07:00
|
|
|
(* WARNING: if you change something in this file, you must look at
|
2001-06-18 05:26:27 -07:00
|
|
|
opterrors.ml to see if you need to make the same changes there.
|
2001-06-15 12:09:45 -07:00
|
|
|
*)
|
2000-10-31 06:55:30 -08:00
|
|
|
|
2001-06-15 12:09:45 -07:00
|
|
|
open Format
|
1995-05-04 03:15:53 -07:00
|
|
|
|
|
|
|
(* Report an error *)
|
|
|
|
|
2000-03-06 14:12:09 -08:00
|
|
|
let report_error ppf exn =
|
|
|
|
let report ppf = function
|
2002-11-01 09:06:47 -08:00
|
|
|
| Lexer.Error(err, loc) ->
|
|
|
|
Location.print ppf loc;
|
2000-03-06 14:12:09 -08:00
|
|
|
Lexer.report_error ppf err
|
1997-08-22 01:55:41 -07:00
|
|
|
| Syntaxerr.Error err ->
|
2000-03-06 14:12:09 -08:00
|
|
|
Syntaxerr.report_error ppf err
|
2002-02-08 02:14:31 -08:00
|
|
|
| Pparse.Error ->
|
|
|
|
fprintf ppf "Preprocessor error"
|
1995-05-04 03:15:53 -07:00
|
|
|
| Env.Error err ->
|
2000-03-06 14:12:09 -08:00
|
|
|
Env.report_error ppf err
|
|
|
|
| Ctype.Tags(l, l') -> fprintf ppf
|
|
|
|
"In this program,@ variant constructors@ `%s and `%s@ \
|
2002-01-03 18:02:50 -08:00
|
|
|
have the same hash value.@ Change one of them." l l'
|
1995-05-04 03:15:53 -07:00
|
|
|
| Typecore.Error(loc, err) ->
|
2000-03-06 14:12:09 -08:00
|
|
|
Location.print ppf loc; Typecore.report_error ppf err
|
1995-05-04 03:15:53 -07:00
|
|
|
| Typetexp.Error(loc, err) ->
|
2000-03-06 14:12:09 -08:00
|
|
|
Location.print ppf loc; Typetexp.report_error ppf err
|
1995-05-04 03:15:53 -07:00
|
|
|
| Typedecl.Error(loc, err) ->
|
2000-03-06 14:12:09 -08:00
|
|
|
Location.print ppf loc; Typedecl.report_error ppf err
|
2003-06-19 08:53:53 -07:00
|
|
|
| Typeclass.Error(loc, err) ->
|
|
|
|
Location.print ppf loc; Typeclass.report_error ppf err
|
1995-05-04 03:15:53 -07:00
|
|
|
| Includemod.Error err ->
|
2000-03-06 14:12:09 -08:00
|
|
|
Includemod.report_error ppf err
|
1995-05-04 03:15:53 -07:00
|
|
|
| Typemod.Error(loc, err) ->
|
2000-03-06 14:12:09 -08:00
|
|
|
Location.print ppf loc; Typemod.report_error ppf err
|
1995-05-04 03:15:53 -07:00
|
|
|
| Translcore.Error(loc, err) ->
|
2000-03-06 14:12:09 -08:00
|
|
|
Location.print ppf loc; Translcore.report_error ppf err
|
2003-06-19 08:53:53 -07:00
|
|
|
| Translclass.Error(loc, err) ->
|
|
|
|
Location.print ppf loc; Translclass.report_error ppf err
|
|
|
|
| Translmod.Error(loc, err) ->
|
|
|
|
Location.print ppf loc; Translmod.report_error ppf err
|
1995-05-04 03:15:53 -07:00
|
|
|
| Symtable.Error code ->
|
2000-03-06 14:12:09 -08:00
|
|
|
Symtable.report_error ppf code
|
1995-07-02 09:45:41 -07:00
|
|
|
| Bytelink.Error code ->
|
2000-03-06 14:12:09 -08:00
|
|
|
Bytelink.report_error ppf code
|
1995-07-11 11:07:53 -07:00
|
|
|
| Bytelibrarian.Error code ->
|
2000-03-06 14:12:09 -08:00
|
|
|
Bytelibrarian.report_error ppf code
|
2002-02-08 08:55:44 -08:00
|
|
|
| Bytepackager.Error code ->
|
|
|
|
Bytepackager.report_error ppf code
|
1995-05-04 03:15:53 -07:00
|
|
|
| Sys_error msg ->
|
2000-03-06 14:12:09 -08:00
|
|
|
fprintf ppf "I/O error: %s" msg
|
2000-08-23 10:13:17 -07:00
|
|
|
| Warnings.Errors (n) ->
|
2006-01-04 08:55:50 -08:00
|
|
|
fprintf ppf "@.Error: error-enabled warnings (%d occurrences)" n
|
2000-03-07 17:48:22 -08:00
|
|
|
| x -> fprintf ppf "@]"; raise x in
|
2000-03-06 14:12:09 -08:00
|
|
|
|
|
|
|
fprintf ppf "@[%a@]@." report exn
|