comparison trunk/src/main.d @ 758:f4b9680c0e16

Revised module dil.SettingsLoader.
author Aziz K?ksal <aziz.koeksal@gmail.com>
date Thu, 14 Feb 2008 03:31:19 +0100
parents 804111ec8213
children 9c47f377ca0b
comparison
equal deleted inserted replaced
757:e4b60543c5e8 758:f4b9680c0e16
39 import tango.time.StopWatch; 39 import tango.time.StopWatch;
40 import tango.text.Ascii : icompare; 40 import tango.text.Ascii : icompare;
41 41
42 void main(char[][] args) 42 void main(char[][] args)
43 { 43 {
44 dil.SettingsLoader.loadSettings(); 44 auto infoMan = new InfoManager();
45 SettingsLoader(infoMan).load();
46 if (infoMan.info.length)
47 return printErrors(infoMan);
45 48
46 if (args.length <= 1) 49 if (args.length <= 1)
47 return Stdout(helpMain()).newline; 50 return Stdout(helpMain()).newline;
48 51
49 string command = args[1]; 52 string command = args[1];
51 { 54 {
52 case "c", "compile": 55 case "c", "compile":
53 if (args.length < 2) 56 if (args.length < 2)
54 return printHelp("compile"); 57 return printHelp("compile");
55 58
56 auto infoMan = new InfoManager(); 59 infoMan = new InfoManager();
57 auto filePaths = args[2..$]; 60 auto filePaths = args[2..$];
58 foreach (filePath; filePaths) 61 foreach (filePath; filePaths)
59 { 62 {
60 auto mod = new Module(filePath, infoMan); 63 auto mod = new Module(filePath, infoMan);
61 // Parse the file. 64 // Parse the file.
106 macroPaths ~= arg; 109 macroPaths ~= arg;
107 else 110 else
108 filePaths ~= arg; 111 filePaths ~= arg;
109 } 112 }
110 113
111 auto infoMan = new InfoManager(); 114 infoMan = new InfoManager();
112 // Execute command. 115 // Execute command.
113 cmd.DDoc.execute(filePaths, destination, macroPaths, incUndoc, verbose, infoMan); 116 cmd.DDoc.execute(filePaths, destination, macroPaths, incUndoc, verbose, infoMan);
114 if (infoMan.info.length) 117 if (infoMan.info.length)
115 return printErrors(infoMan); 118 return printErrors(infoMan);
116 break; 119 break;
218 221
219 separator || (separator = "\n"); 222 separator || (separator = "\n");
220 if (!sourceText) 223 if (!sourceText)
221 sourceText = new SourceText(filePath, true); 224 sourceText = new SourceText(filePath, true);
222 225
223 auto infoMan = new InfoManager(); 226 infoMan = new InfoManager();
224 auto lx = new Lexer(sourceText, infoMan); 227 auto lx = new Lexer(sourceText, infoMan);
225 lx.scanAll(); 228 lx.scanAll();
226 auto token = lx.firstToken(); 229 auto token = lx.firstToken();
227 230
228 for (; token.kind != TOK.EOF; token = token.next) 231 for (; token.kind != TOK.EOF; token = token.next)
241 return printHelp("trans"); 244 return printHelp("trans");
242 245
243 if (args[2] != "German") 246 if (args[2] != "German")
244 return Stdout.formatln("Error: unrecognized target language \"{}\"", args[2]); 247 return Stdout.formatln("Error: unrecognized target language \"{}\"", args[2]);
245 248
246 auto infoMan = new InfoManager(); 249 infoMan = new InfoManager();
247 auto filePath = args[3]; 250 auto filePath = args[3];
248 auto mod = new Module(filePath, infoMan); 251 auto mod = new Module(filePath, infoMan);
249 // Parse the file. 252 // Parse the file.
250 mod.parse(); 253 mod.parse();
251 if (!mod.hasErrors) 254 if (!mod.hasErrors)