annotate trunk/src/dil/Information.d @ 759:9c47f377ca0b

Revised module cmd.Generate. Added class TagMapLoader. Fixed StringExpression.getString() and related code in the Parser. Added options 'xml_map' and 'html_map' to config.d
author Aziz K?ksal <aziz.koeksal@gmail.com>
date Fri, 15 Feb 2008 02:07:53 +0100
parents 7173ece1b696
children 3b34f6a95a27
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
249
32d354584b28 - Upgraded license notices to GPL3.
aziz
parents: 94
diff changeset
3 License: GPL3
69
24db7c5522d5 - Added module Information for compiler messages like warnings, info and errors to the user.
aziz
parents:
diff changeset
4 +/
326
4a7359b88c11 - Added package 'dil' to module declarations.
aziz
parents: 325
diff changeset
5 module dil.Information;
514
6ddff941862a Added new error classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 490
diff changeset
6
327
a48a987f7515 - Added package dil to import declarations.
aziz
parents: 326
diff changeset
7 import dil.Messages;
391
33b566df6af4 Migrated project to Tango.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 327
diff changeset
8 import common;
69
24db7c5522d5 - Added module Information for compiler messages like warnings, info and errors to the user.
aziz
parents:
diff changeset
9
490
47be6bfe39cd Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 486
diff changeset
10 public import dil.Location;
47be6bfe39cd Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 486
diff changeset
11
69
24db7c5522d5 - Added module Information for compiler messages like warnings, info and errors to the user.
aziz
parents:
diff changeset
12 class Information
24db7c5522d5 - Added module Information for compiler messages like warnings, info and errors to the user.
aziz
parents:
diff changeset
13 {
514
6ddff941862a Added new error classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 490
diff changeset
14
6ddff941862a Added new error classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 490
diff changeset
15 }
6ddff941862a Added new error classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 490
diff changeset
16
532
50e64bab9c7a Renamed InformationManager to InfoManager.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 518
diff changeset
17 class InfoManager
514
6ddff941862a Added new error classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 490
diff changeset
18 {
6ddff941862a Added new error classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 490
diff changeset
19 Information[] info;
518
8f86bb9ef715 Added module dil.Converter and dil.FileBOM.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 514
diff changeset
20
759
9c47f377ca0b Revised module cmd.Generate.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 744
diff changeset
21 bool hasInfo()
9c47f377ca0b Revised module cmd.Generate.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 744
diff changeset
22 {
9c47f377ca0b Revised module cmd.Generate.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 744
diff changeset
23 return info.length != 0;
9c47f377ca0b Revised module cmd.Generate.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 744
diff changeset
24 }
9c47f377ca0b Revised module cmd.Generate.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 744
diff changeset
25
518
8f86bb9ef715 Added module dil.Converter and dil.FileBOM.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 514
diff changeset
26 void opCatAssign(Information info)
8f86bb9ef715 Added module dil.Converter and dil.FileBOM.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 514
diff changeset
27 {
8f86bb9ef715 Added module dil.Converter and dil.FileBOM.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 514
diff changeset
28 this.info ~= info;
8f86bb9ef715 Added module dil.Converter and dil.FileBOM.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 514
diff changeset
29 }
744
7173ece1b696 Wrapped some macro functions inside struct MacroExpander.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 532
diff changeset
30
7173ece1b696 Wrapped some macro functions inside struct MacroExpander.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 532
diff changeset
31 void opCatAssign(Information[] info)
7173ece1b696 Wrapped some macro functions inside struct MacroExpander.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 532
diff changeset
32 {
7173ece1b696 Wrapped some macro functions inside struct MacroExpander.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 532
diff changeset
33 this.info ~= info;
7173ece1b696 Wrapped some macro functions inside struct MacroExpander.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 532
diff changeset
34 }
514
6ddff941862a Added new error classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 490
diff changeset
35 }
6ddff941862a Added new error classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 490
diff changeset
36
6ddff941862a Added new error classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 490
diff changeset
37 class Problem : Information
6ddff941862a Added new error classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 490
diff changeset
38 {
422
ad7977fe315a Added support for column numbers in error messages.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 391
diff changeset
39 Location location;
514
6ddff941862a Added new error classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 490
diff changeset
40 uint column; /// Cache variable for column.
391
33b566df6af4 Migrated project to Tango.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 327
diff changeset
41 string message;
69
24db7c5522d5 - Added module Information for compiler messages like warnings, info and errors to the user.
aziz
parents:
diff changeset
42
514
6ddff941862a Added new error classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 490
diff changeset
43 this(Location location, string message)
69
24db7c5522d5 - Added module Information for compiler messages like warnings, info and errors to the user.
aziz
parents:
diff changeset
44 {
422
ad7977fe315a Added support for column numbers in error messages.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 391
diff changeset
45 assert(location !is null);
ad7977fe315a Added support for column numbers in error messages.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 391
diff changeset
46 this.location = location;
391
33b566df6af4 Migrated project to Tango.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 327
diff changeset
47 this.message = message;
69
24db7c5522d5 - Added module Information for compiler messages like warnings, info and errors to the user.
aziz
parents:
diff changeset
48 }
24db7c5522d5 - Added module Information for compiler messages like warnings, info and errors to the user.
aziz
parents:
diff changeset
49
24db7c5522d5 - Added module Information for compiler messages like warnings, info and errors to the user.
aziz
parents:
diff changeset
50 string getMsg()
24db7c5522d5 - Added module Information for compiler messages like warnings, info and errors to the user.
aziz
parents:
diff changeset
51 {
391
33b566df6af4 Migrated project to Tango.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 327
diff changeset
52 return this.message;
69
24db7c5522d5 - Added module Information for compiler messages like warnings, info and errors to the user.
aziz
parents:
diff changeset
53 }
422
ad7977fe315a Added support for column numbers in error messages.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 391
diff changeset
54
514
6ddff941862a Added new error classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 490
diff changeset
55 /// Returns the line of code.
422
ad7977fe315a Added support for column numbers in error messages.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 391
diff changeset
56 size_t loc()
ad7977fe315a Added support for column numbers in error messages.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 391
diff changeset
57 {
ad7977fe315a Added support for column numbers in error messages.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 391
diff changeset
58 return location.lineNum;
ad7977fe315a Added support for column numbers in error messages.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 391
diff changeset
59 }
ad7977fe315a Added support for column numbers in error messages.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 391
diff changeset
60
514
6ddff941862a Added new error classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 490
diff changeset
61 /// Returns the column.
422
ad7977fe315a Added support for column numbers in error messages.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 391
diff changeset
62 size_t col()
ad7977fe315a Added support for column numbers in error messages.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 391
diff changeset
63 {
ad7977fe315a Added support for column numbers in error messages.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 391
diff changeset
64 if (column == 0)
ad7977fe315a Added support for column numbers in error messages.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 391
diff changeset
65 column = location.calculateColumn();
ad7977fe315a Added support for column numbers in error messages.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 391
diff changeset
66 return column;
ad7977fe315a Added support for column numbers in error messages.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 391
diff changeset
67 }
ad7977fe315a Added support for column numbers in error messages.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 391
diff changeset
68
514
6ddff941862a Added new error classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 490
diff changeset
69 /// Returns the file path.
422
ad7977fe315a Added support for column numbers in error messages.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 391
diff changeset
70 string filePath()
ad7977fe315a Added support for column numbers in error messages.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 391
diff changeset
71 {
ad7977fe315a Added support for column numbers in error messages.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 391
diff changeset
72 return location.filePath;
ad7977fe315a Added support for column numbers in error messages.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 391
diff changeset
73 }
69
24db7c5522d5 - Added module Information for compiler messages like warnings, info and errors to the user.
aziz
parents:
diff changeset
74 }
422
ad7977fe315a Added support for column numbers in error messages.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 391
diff changeset
75
514
6ddff941862a Added new error classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 490
diff changeset
76 class Warning : Problem
6ddff941862a Added new error classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 490
diff changeset
77 {
6ddff941862a Added new error classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 490
diff changeset
78 this(Location location, string message)
6ddff941862a Added new error classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 490
diff changeset
79 {
6ddff941862a Added new error classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 490
diff changeset
80 super(location, message);
6ddff941862a Added new error classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 490
diff changeset
81 }
6ddff941862a Added new error classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 490
diff changeset
82 }
6ddff941862a Added new error classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 490
diff changeset
83
6ddff941862a Added new error classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 490
diff changeset
84 class Error : Problem
6ddff941862a Added new error classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 490
diff changeset
85 {
6ddff941862a Added new error classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 490
diff changeset
86 this(Location location, string message)
6ddff941862a Added new error classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 490
diff changeset
87 {
6ddff941862a Added new error classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 490
diff changeset
88 super(location, message);
6ddff941862a Added new error classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 490
diff changeset
89 }
6ddff941862a Added new error classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 490
diff changeset
90 }
6ddff941862a Added new error classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 490
diff changeset
91
6ddff941862a Added new error classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 490
diff changeset
92 class LexerError : Error
486
bd176bc73e43 Fixed a few things in the Parser.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 434
diff changeset
93 {
514
6ddff941862a Added new error classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 490
diff changeset
94 this(Location location, string message)
6ddff941862a Added new error classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 490
diff changeset
95 {
6ddff941862a Added new error classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 490
diff changeset
96 super(location, message);
6ddff941862a Added new error classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 490
diff changeset
97 }
486
bd176bc73e43 Fixed a few things in the Parser.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 434
diff changeset
98 }
514
6ddff941862a Added new error classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 490
diff changeset
99
6ddff941862a Added new error classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 490
diff changeset
100 class ParserError : Error
6ddff941862a Added new error classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 490
diff changeset
101 {
6ddff941862a Added new error classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 490
diff changeset
102 this(Location location, string message)
6ddff941862a Added new error classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 490
diff changeset
103 {
6ddff941862a Added new error classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 490
diff changeset
104 super(location, message);
6ddff941862a Added new error classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 490
diff changeset
105 }
6ddff941862a Added new error classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 490
diff changeset
106 }
6ddff941862a Added new error classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 490
diff changeset
107
6ddff941862a Added new error classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 490
diff changeset
108 class SemanticError : Error
6ddff941862a Added new error classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 490
diff changeset
109 {
6ddff941862a Added new error classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 490
diff changeset
110 this(Location location, string message)
6ddff941862a Added new error classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 490
diff changeset
111 {
6ddff941862a Added new error classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 490
diff changeset
112 super(location, message);
6ddff941862a Added new error classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 490
diff changeset
113 }
6ddff941862a Added new error classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 490
diff changeset
114 }