diff trunk/src/dil/Module.d @ 368:2adf808343d6

- Renamed method start() to init() in Parser. - Renamed method parseModule() to start() in Parser. - Added method parseModuleDeclaration(). - Added class ImportParser which inherits from Parser. It's used as a lightweight parser for parsing module and import declarations. - Added member isLightweight to Module. - Removed calls to Parser.parseModule() and replaced them with Parser.start().
author aziz
date Sat, 01 Sep 2007 11:23:01 +0000
parents dda55fae37de
children ae4afb66768f
line wrap: on
line diff
--- a/trunk/src/dil/Module.d	Fri Aug 31 23:07:05 2007 +0000
+++ b/trunk/src/dil/Module.d	Sat Sep 01 11:23:01 2007 +0000
@@ -12,6 +12,7 @@
 
 class Module
 {
+  bool isLightweight; /// If true an ImportParser is used instead of a full Parser.
   string fileName; /// Path to the source file.
   string packageName;
   string moduleName;
@@ -22,18 +23,21 @@
 
   Module[] modules;
 
-  this(string fileName)
+  this(string fileName, bool isLight = false)
   {
     this.fileName = fileName;
+    this.isLightweight = isLightweight;
   }
 
   void parse()
   {
     auto sourceText = loadFile(fileName);
-    this.parser = new Parser(sourceText, fileName);
-    parser.start();
+    if (this.isLightweight)
+      this.parser = new ImportParser(sourceText, fileName);
+    else
+      this.parser = new Parser(sourceText, fileName);
 
-    this.root = parser.parseModule();
+    this.root = parser.start();
 
     if (root.children.length)
     {