1 (***********************************************************************)
5 (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *)
7 (* Copyright 1997 Institut National de Recherche en Informatique et *)
8 (* en Automatique. All rights reserved. This file is distributed *)
9 (* under the terms of the Q Public License version 1.0. *)
11 (***********************************************************************)
15 (* Auxiliary type for reporting syntax errors *)
20 Unclosed
of Location.t
* string * Location.t
* string
23 exception Error
of error
24 exception Escape_error
26 let report_error ppf
= function
27 | Unclosed
(opening_loc
, opening
, closing_loc
, closing
) ->
28 if String.length
!Location.input_name
= 0
29 && Location.highlight_locations ppf opening_loc closing_loc
30 then fprintf ppf
"Syntax error: '%s' expected, \
31 the highlighted '%s' might be unmatched" closing opening
33 fprintf ppf
"%aSyntax error: '%s' expected@."
34 Location.print closing_loc closing
;
35 fprintf ppf
"%aThis '%s' might be unmatched"
36 Location.print opening_loc opening
39 fprintf ppf
"%aSyntax error" Location.print loc