Mercurial > projects > dil
diff trunk/src/main.d @ 309:b4d842b0d2c7
- Added new files Settings.d, config.d and lang_en.d
- Removed redundant break statements from Lexer.d.
- Added function Cast() to SyntaxTree.d.
- Relocated compiler version info to Settings.d.
- Removed messages variable from module Messages. Compiler messages are loaded dynamically now.
- Relocated some functions from module Information to module Messages, and added some format functions to it.
- Message tables are located in their own lang_*.d files.
- Added getString() method to class StringLiteralsExpression.
- Module Settings has a static struct GlobalSettings. It loads global settings from config.d and a language file.
author | aziz |
---|---|
date | Wed, 15 Aug 2007 16:07:05 +0000 |
parents | 3b9fc1e72210 |
children | fa0b6f32c1ae |
line wrap: on
line diff
--- a/trunk/src/main.d Tue Aug 14 18:35:02 2007 +0000 +++ b/trunk/src/main.d Wed Aug 15 16:07:05 2007 +0000 @@ -9,45 +9,22 @@ import Messages; import std.stdio; import std.file; -import std.metastrings; - -import Declarations, SyntaxTree; - -version(D2) -{ - const VERSION_MAJOR = 2; - const VERSION_MINOR = 0; -} -else -{ - const VERSION_MAJOR = 1; - const VERSION_MINOR = 0; -} -const string VERSION = Format!("%s.%s", VERSION_MAJOR, VERSION_MINOR); - -const char[] usageHighlight = "highlight (hl) file.d"; -const string helpMain = `dil v`~VERSION~` -Copyright (c) 2007 by Aziz Köksal - -Subcommands: - `~usageHighlight~` - -Type 'dil help <subcommand>' for more help on a particular subcommand. - -Compiled with `~__VENDOR__~` `~Format!("v%s.%s", __VERSION__/1000, __VERSION__%1000)~` on `~__TIMESTAMP__~`. -`; +import Settings; +import Declarations, Expressions, SyntaxTree; void main(char[][] args) { + GlobalSettings.load(); + if (args.length <= 1) - return writefln(helpMain); + return writefln(format(MID.HelpMain, VERSION, usageHighlight, COMPILED_WITH, COMPILED_VERSION, COMPILED_DATE)); string command = args[1]; switch (command) { case "hl", "highlight": if (args.length == 3) - highlightTokens(args[2]); + tokensToXML(args[2]); break; default: } @@ -90,7 +67,7 @@ return result; } -void highlightTokens(string fileName) +void tokensToXML(string fileName) { auto sourceText = cast(char[]) std.file.read(fileName); auto lx = new Lexer(sourceText, fileName);