Mercurial > projects > dil
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/trunk/src/Information.d Sun Jul 01 13:53:00 2007 +0000 @@ -0,0 +1,44 @@ +/++ + Author: Aziz Köksal + License: GPL2 ++/ +module Information; +import Messages; +import std.string; + +enum Type +{ + Lexer, + Parser, + Semantic +} + +class Information +{ + MID id; + Type type; + uint loc; + string[] arguments; + + this(Type type, MID id, uint loc, string[] arguments) + { + this.id = id; + this.type = type; + this.loc = loc; + this.arguments = arguments; + } + + string getMsg() + { + char[] msg = messages[id]; + + if (arguments.length == 0) + return msg; + + foreach (i, arg; arguments) + msg = replace(msg, format("{%s}", i+1), arg); + + return msg; + } +} +