Mercurial > projects > dil
comparison src/main.d @ 808:28e1ff1dcfcf
Renamed generate command to highlight and refactored it.
author | Aziz K?ksal <aziz.koeksal@gmail.com> |
---|---|
date | Sun, 09 Mar 2008 16:10:25 +0100 |
parents | a2880c95eda3 |
children | 7e84472f4e91 |
comparison
equal
deleted
inserted
replaced
807:a2880c95eda3 | 808:28e1ff1dcfcf |
---|---|
22 import dil.CompilerInfo; | 22 import dil.CompilerInfo; |
23 import dil.Information; | 23 import dil.Information; |
24 import dil.SourceText; | 24 import dil.SourceText; |
25 import dil.Compilation; | 25 import dil.Compilation; |
26 | 26 |
27 import cmd.Generate; | 27 import cmd.Highlight; |
28 import cmd.Statistics; | 28 import cmd.Statistics; |
29 import cmd.ImportGraph; | 29 import cmd.ImportGraph; |
30 import cmd.DDoc; | 30 import cmd.DDoc; |
31 | 31 |
32 import Settings; | 32 import Settings; |
127 cmd.filePaths ~= arg; | 127 cmd.filePaths ~= arg; |
128 } | 128 } |
129 cmd.run(); | 129 cmd.run(); |
130 infoMan.hasInfo && printErrors(infoMan); | 130 infoMan.hasInfo && printErrors(infoMan); |
131 break; | 131 break; |
132 case "gen", "generate": | 132 case "hl", "highlight": |
133 char[] fileName; | 133 if (args.length < 3) |
134 GenOption options = GenOption.Tokens; | 134 return printHelp("hl"); |
135 | |
136 HighlightCommand cmd; | |
137 cmd.infoMan = infoMan; | |
138 | |
135 foreach (arg; args[2..$]) | 139 foreach (arg; args[2..$]) |
136 { | 140 { |
137 switch (arg) | 141 switch (arg) |
138 { | 142 { |
139 case "--syntax": | 143 case "--syntax": |
140 options |= GenOption.Syntax; break; | 144 cmd.add(HighlightCommand.Option.Syntax); break; |
141 case "--xml": | 145 case "--xml": |
142 options |= GenOption.XML; break; | 146 cmd.add(HighlightCommand.Option.XML); break; |
143 case "--html": | 147 case "--html": |
144 options |= GenOption.HTML; break; | 148 cmd.add(HighlightCommand.Option.HTML); break; |
145 case "--lines": | 149 case "--lines": |
146 options |= GenOption.PrintLines; break; | 150 cmd.add(HighlightCommand.Option.PrintLines); break; |
147 default: | 151 default: |
148 fileName = arg; | 152 cmd.filePath = arg; |
149 } | 153 } |
150 } | 154 } |
151 if (!(options & (GenOption.XML | GenOption.HTML))) | 155 cmd.run(); |
152 options |= GenOption.XML; // Default to XML. | |
153 cmd.Generate.execute(fileName, options, infoMan); | |
154 infoMan.hasInfo && printErrors(infoMan); | 156 infoMan.hasInfo && printErrors(infoMan); |
155 break; | 157 break; |
156 case "importgraph", "igraph": | 158 case "importgraph", "igraph": |
157 string filePath; | 159 string filePath; |
158 string[] regexps; | 160 string[] regexps; |
324 | 326 |
325 /// Available commands. | 327 /// Available commands. |
326 const char[] COMMANDS = | 328 const char[] COMMANDS = |
327 " compile (c)\n" | 329 " compile (c)\n" |
328 " ddoc (d)\n" | 330 " ddoc (d)\n" |
329 " generate (gen)\n" | |
330 " help (?)\n" | 331 " help (?)\n" |
332 " highlight (hl)\n" | |
331 " importgraph (igraph)\n" | 333 " importgraph (igraph)\n" |
332 " statistics (stats)\n" | 334 " statistics (stats)\n" |
333 " tokenize (tok)\n" | 335 " tokenize (tok)\n" |
334 " translate (trans)\n"; | 336 " translate (trans)\n"; |
335 | 337 |
455 -v : verbose output | 457 -v : verbose output |
456 | 458 |
457 Example: | 459 Example: |
458 dil d doc/ src/main.d src/macros_dil.ddoc -i`; | 460 dil d doc/ src/main.d src/macros_dil.ddoc -i`; |
459 break; | 461 break; |
460 case "gen", "generate": | 462 case "hl", "highlight": |
461 // msg = GetMsg(MID.HelpGenerate); | 463 // msg = GetMsg(MID.HelpGenerate); |
462 msg = `Generate an XML or HTML document from a D source file. | 464 msg = `Highlight a D source file with XML or HTML tags. |
463 Usage: | 465 Usage: |
464 dil gen file.d [Options] | 466 dil hl file.d [Options] |
465 | 467 |
466 Options: | 468 Options: |
467 --syntax : generate tags for the syntax tree | 469 --syntax : generate tags for the syntax tree |
468 --xml : use XML format (default) | 470 --xml : use XML format (default) |
469 --html : use HTML format | 471 --html : use HTML format |
470 --lines : print line numbers | 472 --lines : print line numbers |
471 | 473 |
472 Example: | 474 Example: |
473 dil gen Parser.d --html --syntax > Parser.html`; | 475 dil hl Parser.d --html --syntax > Parser.html`; |
474 break; | 476 break; |
475 case "importgraph", "igraph": | 477 case "importgraph", "igraph": |
476 // msg = GetMsg(MID.HelpImportGraph); | 478 // msg = GetMsg(MID.HelpImportGraph); |
477 msg = `Parse a module and build a module dependency graph based on its imports. | 479 msg = `Parse a module and build a module dependency graph based on its imports. |
478 Usage: | 480 Usage: |