Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 79 lines (58 sloc) 2.559 kB
fccc685 Initial open-source release
MLstate authored
1 (*
2 Copyright © 2011 MLstate
3
4 This file is part of OPA.
5
6 OPA is free software: you can redistribute it and/or modify it under the
7 terms of the GNU Affero General Public License, version 3, as published by
8 the Free Software Foundation.
9
10 OPA is distributed in the hope that it will be useful, but WITHOUT ANY
11 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
13 more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with OPA. If not, see <http://www.gnu.org/licenses/>.
17 *)
18 (**
19 Error management for Opa.
20
21 @author Quentin Bourgerie by plagiarism (Esther Baruk & Mathieu Barbin)
22 *)
23
24 (** {6 Design note} *)
25
26 (**
27 This module is meant to factorize code to create located error messages, for a
28 public or an internal audience.
29
30 This module uses internally the [passlib] which offers the opportunity to passes
31 and checkers to be more verbose and outputting a detailed context in the track
32 system, which can be analyzed after the compilation (or after the last error),
33 using [opatrack]
34 *)
35
36 (** {6 Context} *)
37
38 module Context :
39 sig
40 type context
41
42 (** Merging several context *)
43 val merge2 : context -> context -> context
44 val merge : context -> context list -> context
45
46 val pos : FilePos.pos -> context
47 val type_ : BslTypes.t -> context
48
49 (** if needed, add some other context constructors, and merge,
50 like [qmlError] *)
51 end
52
53 type context = Context.context
54
55 (**
56 The documentation of these function is in [PassHandler] and [PassError]
57 *)
58
59 (** {6 Interaction with Checkers} *)
60
61 (** *)
62 val check_fail : PassHandler.cond_id -> context -> ('a, 'error) OManager.oformat -> 'a
63 val scheck_fail : PassHandler.cond_id -> context -> ('a, unit) OManager.oformat -> 'a
64
65 (** {6 Interaction with Passes} *)
66
67 (** Internal Errors *)
68 (** *)
69 val cond_violation : PassHandler.cond_id -> context -> ('a, 'error) OManager.oformat -> 'a
70 val scond_violation : PassHandler.cond_id -> context -> ('a, unit) OManager.oformat -> 'a
71 val i_error : PassHandler.cond_id option -> context -> ('a, 'error) OManager.oformat -> 'a
72 val i_serror : PassHandler.cond_id option -> context -> ('a, unit) OManager.oformat -> 'a
73
74 (** Public Errors *)
75 (** *)
76 val error : context -> ('params, 'exit) OManager.oformat -> 'params
77 val serror : context -> ('params, unit) OManager.oformat -> 'params
78 val warning : wclass:WarningClass.wclass -> context -> ('params, unit) OManager.oformat -> 'params
Something went wrong with that request. Please try again.