3 * Author: Kaustuv Chaudhuri <kaustuv+@cs.cmu.edu>
4 * Annotations: Alex Vaynberg <alv@andrew.cmu.edu>
5 * Modified: Frank Pfenning <fp@cs.cmu.edu>
10 (* clears out all errors from the system *)
11 val reset : unit -> unit
13 (* global flag that indicates whether there were errors *)
14 val anyErrors : bool ref
16 (* sets the error flag and prints out an error message, does NOT raise ERROR *)
17 val error : Mark.ext option -> string -> unit
18 (* same, but does not increment error count *)
19 val warn : Mark.ext option -> string -> unit
21 (* generic code stopping exception *)
23 exception InternalError of string
26 structure ErrorMsg :> ERRORMSG =
28 (* Initial values of compiler state variables *)
29 val anyErrors = ref false
31 fun reset() = ( anyErrors := false )
33 fun msg str ext note =
35 Option.map (TextIO.print o Mark.show) ext;
36 List.app TextIO.print [":", str, ":", note, "\n"])
38 fun error ext note = (anyErrors := true; msg "error" ext note)
39 fun warn ext note = msg "warning" ext note
41 (* Print the given error message and then abort compilation *)
43 exception InternalError of string