forked from mozart/mozart2-compiler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathErrors.oz
69 lines (68 loc) · 2.16 KB
/
Errors.oz
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
%%%
%%% Author:
%%% Leif Kornstaedt <[email protected]>
%%%
%%% Contributors:
%%% Martin Mueller <[email protected]>
%%%
%%% Copyright:
%%% Leif Kornstaedt, 1997
%%%
%%% Last change:
%%% $Date$ by $Author$
%%% $Revision$
%%%
%%% This file is part of Mozart, an implementation of Oz 3:
%%% http://www.mozart-oz.org
%%%
%%% See the file "LICENSE" or
%%% http://www.mozart-oz.org/LICENSE.html
%%% for information on usage and redistribution
%%% of this file, and for a DISCLAIMER OF ALL
%%% WARRANTIES.
%%%
{Error.registerFormatter compiler
fun {$ E}
BugReport = 'Please send bug report to [email protected]'
T = 'compiler engine error'
in
case E of compiler(internal X) then
error(kind: T
msg: 'Internal compiler error'
items: [hint(l: 'Additional information' m: oz(X))
line(BugReport)])
elseof compiler(invalidQuery M) then
error(kind: T
msg: 'Invalid query'
items: [hint(l: 'Query' m: oz(M))])
elseof compiler(invalidQuery M I A) then
error(kind: T
msg: 'Ill-typed query argument'
items: [hint(l: 'Query' m: oz(M))
hint(l: 'At argument' m: I)
hint(l: 'Expected type' m: A)])
elseof compiler(evalExpression VS Ms) then
error(kind: T
msg: 'Erroneous expression in Compiler.evalExpression'
items: (hint(l: 'Expression' m: VS)|
{Map Ms
fun {$ M}
case M of error(kind: Kind msg: Msg ...) then
line(Kind#': '#Msg)
elseof warn(kind: Kind msg: Msg ...) then
line(Kind#': '#Msg)
else unit
end
end}))
elseof compiler(malformedSyntaxTree) then
error(kind: T
msg: 'Malformed syntax tree')
elseof compiler(malformedSyntaxTree X) then
error(kind: T
msg: 'Malformed syntax tree'
items: [hint(l: 'Matching' m: oz(X))])
else
error(kind: T
items: [line(oz(E))])
end
end}