Mercurial > projects > dil
comparison trunk/src/dil/Module.d @ 520:f203c5248d0b
Added 'compile' command.
Fixes in config.d: changed 'auto' to 'var'; fixed format argument indices.
dil.Lexer and dil.Parser add their errors to infoMan.
Fix in enum TOK: Cent belongs to sublist of integral types.
author | Aziz K?ksal <aziz.koeksal@gmail.com> |
---|---|
date | Sat, 15 Dec 2007 22:25:18 +0100 |
parents | 433d51c18524 |
children | 50e64bab9c7a |
comparison
equal
deleted
inserted
replaced
519:9ebc799c7dc5 | 520:f203c5248d0b |
---|---|
1 /++ | 1 /++ |
2 Author: Aziz Köksal | 2 Author: Aziz Köksal |
3 License: GPL3 | 3 License: GPL3 |
4 +/ | 4 +/ |
5 module dil.Module; | 5 module dil.Module; |
6 | |
6 import dil.SyntaxTree; | 7 import dil.SyntaxTree; |
7 import dil.Declarations; | 8 import dil.Declarations; |
8 import dil.Parser; | 9 import dil.Parser; |
9 import dil.ImportParser; | 10 import dil.ImportParser; |
10 import dil.Lexer; | 11 import dil.Lexer; |
11 import dil.File; | 12 import dil.File; |
12 import dil.Scope; | 13 import dil.Scope; |
14 import dil.Information; | |
13 import tango.io.FilePath; | 15 import tango.io.FilePath; |
14 import tango.io.FileConst; | 16 import tango.io.FileConst; |
15 import common; | 17 import common; |
16 | 18 |
17 alias FileConst.PathSeparatorChar dirSep; | 19 alias FileConst.PathSeparatorChar dirSep; |
21 bool isLightweight; /// If true an ImportParser is used instead of a full Parser. | 23 bool isLightweight; /// If true an ImportParser is used instead of a full Parser. |
22 string filePath; /// Path to the source file. | 24 string filePath; /// Path to the source file. |
23 string moduleFQN; /// Fully qualified name of the module. | 25 string moduleFQN; /// Fully qualified name of the module. |
24 string packageName; | 26 string packageName; |
25 string moduleName; | 27 string moduleName; |
28 | |
26 Declarations root; /// The root of the AST. | 29 Declarations root; /// The root of the AST. |
27 ImportDeclaration[] imports; | 30 ImportDeclaration[] imports; |
28 ModuleDeclaration moduleDecl; | 31 ModuleDeclaration moduleDecl; |
29 private Parser parser; | 32 private Parser parser; |
30 | 33 |
31 Module[] modules; | 34 Module[] modules; |
32 | 35 |
36 InformationManager infoMan; | |
37 | |
33 this(string filePath, bool isLightweight = false) | 38 this(string filePath, bool isLightweight = false) |
34 { | 39 { |
35 this.filePath = filePath; | 40 this.filePath = filePath; |
36 this.isLightweight = isLightweight; | 41 this.isLightweight = isLightweight; |
42 } | |
43 | |
44 this(string filePath, InformationManager infoMan) | |
45 { | |
46 this(filePath, false); | |
47 this.infoMan = infoMan; | |
37 } | 48 } |
38 | 49 |
39 void parse() | 50 void parse() |
40 { | 51 { |
41 auto sourceText = loadFile(filePath); | 52 auto sourceText = loadFile(filePath); |
42 if (this.isLightweight) | 53 if (this.isLightweight) |
43 this.parser = new ImportParser(sourceText, filePath); | 54 this.parser = new ImportParser(sourceText, filePath); |
44 else | 55 else |
45 this.parser = new Parser(sourceText, filePath); | 56 this.parser = new Parser(sourceText, filePath, infoMan); |
46 | 57 |
47 this.root = parser.start(); | 58 this.root = parser.start(); |
48 | 59 |
49 if (root.children.length) | 60 if (root.children.length) |
50 { | 61 { |