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
|
|
|
|
| Lexer.Error(err, start, stop) ->
|
2000-10-31 06:55:30 -08:00
|
|
|
Location.print ppf {Location.loc_start = start;
|
|
|
|
Location.loc_end = stop;
|
|
|
|
Location.loc_ghost = false};
|
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
|
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
|
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
|
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
|
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
|
1996-04-22 04:15:41 -07:00
|
|
|
| Typeclass.Error(loc, err) ->
|
2000-03-06 14:12:09 -08:00
|
|
|
Location.print ppf loc; Typeclass.report_error ppf err
|
1998-11-30 10:25:12 -08:00
|
|
|
| Translclass.Error(loc, err) ->
|
2000-03-06 14:12:09 -08:00
|
|
|
Location.print ppf loc; Translclass.report_error ppf err
|
2000-08-23 10:13:17 -07:00
|
|
|
| Warnings.Errors (n) ->
|
|
|
|
fprintf ppf "@.Error: %d error-enabled warnings occurred." 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
|