Mercurial > projects > dil
comparison trunk/src/main.d @ 358:0faf57d99c1c
- Replaced calls to std.file.read() with dil.loadFile().
author | aziz |
---|---|
date | Sun, 26 Aug 2007 15:59:02 +0000 |
parents | 97a9a2d7d46d |
children | 2b387a3c6b58 |
comparison
equal
deleted
inserted
replaced
357:2a56fe53383d | 358:0faf57d99c1c |
---|---|
2 Author: Aziz Köksal | 2 Author: Aziz Köksal |
3 License: GPL3 | 3 License: GPL3 |
4 +/ | 4 +/ |
5 module main; | 5 module main; |
6 import std.stdio; | 6 import std.stdio; |
7 import std.file; | |
8 import dil.Parser; | 7 import dil.Parser; |
9 import dil.Lexer; | 8 import dil.Lexer; |
10 import dil.Token; | 9 import dil.Token; |
11 import dil.Messages; | 10 import dil.Messages; |
12 import dil.Settings; | 11 import dil.Settings; |
92 XML = 1<<3 | 91 XML = 1<<3 |
93 } | 92 } |
94 | 93 |
95 void parse(string fileName) | 94 void parse(string fileName) |
96 { | 95 { |
97 auto sourceText = cast(char[]) std.file.read(fileName); | 96 auto sourceText = loadFile(fileName); |
98 auto parser = new Parser(sourceText, fileName); | 97 auto parser = new Parser(sourceText, fileName); |
99 parser.start(); | 98 parser.start(); |
100 auto root = parser.parseModule(); | 99 auto root = parser.parseModule(); |
101 | 100 |
102 void print(Node[] decls, char[] indent) | 101 void print(Node[] decls, char[] indent) |
333 static assert(xml_tags.length == DocPart.max+1); | 332 static assert(xml_tags.length == DocPart.max+1); |
334 | 333 |
335 void syntaxToDoc(string fileName, DocOption options) | 334 void syntaxToDoc(string fileName, DocOption options) |
336 { | 335 { |
337 auto tags = options & DocOption.HTML ? html_tags : xml_tags; | 336 auto tags = options & DocOption.HTML ? html_tags : xml_tags; |
338 auto sourceText = cast(char[]) std.file.read(fileName); | 337 auto sourceText = loadFile(fileName); |
339 auto parser = new Parser(sourceText, fileName); | 338 auto parser = new Parser(sourceText, fileName); |
340 parser.start(); | 339 parser.start(); |
341 auto root = parser.parseModule(); | 340 auto root = parser.parseModule(); |
342 auto lx = parser.lx; | 341 auto lx = parser.lx; |
343 | 342 |
433 } | 432 } |
434 | 433 |
435 void tokensToDoc(string fileName, DocOption options) | 434 void tokensToDoc(string fileName, DocOption options) |
436 { | 435 { |
437 auto tags = options & DocOption.HTML ? html_tags : xml_tags; | 436 auto tags = options & DocOption.HTML ? html_tags : xml_tags; |
438 auto sourceText = cast(char[]) std.file.read(fileName); | 437 auto sourceText = loadFile(fileName); |
439 auto lx = new Lexer(sourceText, fileName); | 438 auto lx = new Lexer(sourceText, fileName); |
440 | 439 |
441 auto token = lx.getTokens(); | 440 auto token = lx.getTokens(); |
442 char* end = lx.text.ptr; | 441 char* end = lx.text.ptr; |
443 | 442 |