forked from luoruixuan/prfact
-
Notifications
You must be signed in to change notification settings - Fork 0
/
support.mli
54 lines (41 loc) · 1.81 KB
/
support.mli
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
(* module Support
Collects a number of low-level facilities used by the other modules
in the typechecker/evaluator.
*)
(* ------------------------------------------------------------------------ *)
(* Some pervasive abbreviations -- opened everywhere by convention *)
module Pervasive : sig
val pr : string -> unit
end
(* ------------------------------------------------------------------------ *)
(* Error printing utilities -- opened everywhere by convention *)
module Error : sig
(* An exception raised by the low-level error printer; exported
here so that it can be caught in module Main and converted into
an exit status for the whole program. *)
exception Exit of int
(* An element of the type info represents a "file position": a
file name, line number, and character position within the line.
Used for printing error messages. *)
type info
val dummyinfo : info
(* Create file position info: filename lineno column *)
val createInfo : string -> int -> int -> info
val printInfo : info -> unit
(* A convenient datatype for a "value with file info." Used in
the lexer and parser. *)
type 'a withinfo = {i: info; v: 'a}
(* Print an error message and fail. The printing function is called
in a context where the formatter is processing an hvbox. Insert
calls to Format.print_space to print a space or, if necessary,
break the line at that point. *)
val errf : (unit->unit) -> 'a
val errfAt : info -> (unit->unit) -> 'a
(* Convenient wrappers for the above, for the common case where the
action to be performed is just to print a given string. *)
val err : string -> 'a
val error : info -> string -> 'a
(* Variants that print a message but do not fail afterwards *)
val warning : string -> unit
val warningAt : info -> string -> unit
end