Mercurial > projects > dil
annotate trunk/src/Information.d @ 69:24db7c5522d5
- Added module Information for compiler messages like warnings, info and errors to the user.
- Renamed class Problem to Information.
author | aziz |
---|---|
date | Sun, 01 Jul 2007 13:53:00 +0000 |
parents | |
children | b3777cca323c |
rev | line source |
---|---|
69
24db7c5522d5
- Added module Information for compiler messages like warnings, info and errors to the user.
aziz
parents:
diff
changeset
|
1 /++ |
24db7c5522d5
- Added module Information for compiler messages like warnings, info and errors to the user.
aziz
parents:
diff
changeset
|
2 Author: Aziz Köksal |
24db7c5522d5
- Added module Information for compiler messages like warnings, info and errors to the user.
aziz
parents:
diff
changeset
|
3 License: GPL2 |
24db7c5522d5
- Added module Information for compiler messages like warnings, info and errors to the user.
aziz
parents:
diff
changeset
|
4 +/ |
24db7c5522d5
- Added module Information for compiler messages like warnings, info and errors to the user.
aziz
parents:
diff
changeset
|
5 module Information; |
24db7c5522d5
- Added module Information for compiler messages like warnings, info and errors to the user.
aziz
parents:
diff
changeset
|
6 import Messages; |
24db7c5522d5
- Added module Information for compiler messages like warnings, info and errors to the user.
aziz
parents:
diff
changeset
|
7 import std.string; |
24db7c5522d5
- Added module Information for compiler messages like warnings, info and errors to the user.
aziz
parents:
diff
changeset
|
8 |
24db7c5522d5
- Added module Information for compiler messages like warnings, info and errors to the user.
aziz
parents:
diff
changeset
|
9 enum Type |
24db7c5522d5
- Added module Information for compiler messages like warnings, info and errors to the user.
aziz
parents:
diff
changeset
|
10 { |
24db7c5522d5
- Added module Information for compiler messages like warnings, info and errors to the user.
aziz
parents:
diff
changeset
|
11 Lexer, |
24db7c5522d5
- Added module Information for compiler messages like warnings, info and errors to the user.
aziz
parents:
diff
changeset
|
12 Parser, |
24db7c5522d5
- Added module Information for compiler messages like warnings, info and errors to the user.
aziz
parents:
diff
changeset
|
13 Semantic |
24db7c5522d5
- Added module Information for compiler messages like warnings, info and errors to the user.
aziz
parents:
diff
changeset
|
14 } |
24db7c5522d5
- Added module Information for compiler messages like warnings, info and errors to the user.
aziz
parents:
diff
changeset
|
15 |
24db7c5522d5
- Added module Information for compiler messages like warnings, info and errors to the user.
aziz
parents:
diff
changeset
|
16 class Information |
24db7c5522d5
- Added module Information for compiler messages like warnings, info and errors to the user.
aziz
parents:
diff
changeset
|
17 { |
24db7c5522d5
- Added module Information for compiler messages like warnings, info and errors to the user.
aziz
parents:
diff
changeset
|
18 MID id; |
24db7c5522d5
- Added module Information for compiler messages like warnings, info and errors to the user.
aziz
parents:
diff
changeset
|
19 Type type; |
24db7c5522d5
- Added module Information for compiler messages like warnings, info and errors to the user.
aziz
parents:
diff
changeset
|
20 uint loc; |
24db7c5522d5
- Added module Information for compiler messages like warnings, info and errors to the user.
aziz
parents:
diff
changeset
|
21 string[] arguments; |
24db7c5522d5
- Added module Information for compiler messages like warnings, info and errors to the user.
aziz
parents:
diff
changeset
|
22 |
24db7c5522d5
- Added module Information for compiler messages like warnings, info and errors to the user.
aziz
parents:
diff
changeset
|
23 this(Type type, MID id, uint loc, string[] arguments) |
24db7c5522d5
- Added module Information for compiler messages like warnings, info and errors to the user.
aziz
parents:
diff
changeset
|
24 { |
24db7c5522d5
- Added module Information for compiler messages like warnings, info and errors to the user.
aziz
parents:
diff
changeset
|
25 this.id = id; |
24db7c5522d5
- Added module Information for compiler messages like warnings, info and errors to the user.
aziz
parents:
diff
changeset
|
26 this.type = type; |
24db7c5522d5
- Added module Information for compiler messages like warnings, info and errors to the user.
aziz
parents:
diff
changeset
|
27 this.loc = loc; |
24db7c5522d5
- Added module Information for compiler messages like warnings, info and errors to the user.
aziz
parents:
diff
changeset
|
28 this.arguments = arguments; |
24db7c5522d5
- Added module Information for compiler messages like warnings, info and errors to the user.
aziz
parents:
diff
changeset
|
29 } |
24db7c5522d5
- Added module Information for compiler messages like warnings, info and errors to the user.
aziz
parents:
diff
changeset
|
30 |
24db7c5522d5
- Added module Information for compiler messages like warnings, info and errors to the user.
aziz
parents:
diff
changeset
|
31 string getMsg() |
24db7c5522d5
- Added module Information for compiler messages like warnings, info and errors to the user.
aziz
parents:
diff
changeset
|
32 { |
24db7c5522d5
- Added module Information for compiler messages like warnings, info and errors to the user.
aziz
parents:
diff
changeset
|
33 char[] msg = messages[id]; |
24db7c5522d5
- Added module Information for compiler messages like warnings, info and errors to the user.
aziz
parents:
diff
changeset
|
34 |
24db7c5522d5
- Added module Information for compiler messages like warnings, info and errors to the user.
aziz
parents:
diff
changeset
|
35 if (arguments.length == 0) |
24db7c5522d5
- Added module Information for compiler messages like warnings, info and errors to the user.
aziz
parents:
diff
changeset
|
36 return msg; |
24db7c5522d5
- Added module Information for compiler messages like warnings, info and errors to the user.
aziz
parents:
diff
changeset
|
37 |
24db7c5522d5
- Added module Information for compiler messages like warnings, info and errors to the user.
aziz
parents:
diff
changeset
|
38 foreach (i, arg; arguments) |
24db7c5522d5
- Added module Information for compiler messages like warnings, info and errors to the user.
aziz
parents:
diff
changeset
|
39 msg = replace(msg, format("{%s}", i+1), arg); |
24db7c5522d5
- Added module Information for compiler messages like warnings, info and errors to the user.
aziz
parents:
diff
changeset
|
40 |
24db7c5522d5
- Added module Information for compiler messages like warnings, info and errors to the user.
aziz
parents:
diff
changeset
|
41 return msg; |
24db7c5522d5
- Added module Information for compiler messages like warnings, info and errors to the user.
aziz
parents:
diff
changeset
|
42 } |
24db7c5522d5
- Added module Information for compiler messages like warnings, info and errors to the user.
aziz
parents:
diff
changeset
|
43 } |
24db7c5522d5
- Added module Information for compiler messages like warnings, info and errors to the user.
aziz
parents:
diff
changeset
|
44 |