diff trunk/src/dil/Expressions.d @ 490:47be6bfe39cd

Refactored code and added new modules. Added ProtectionDeclaration and changed Parser to make use of it. Moved class Location to its own module. Moved some Lexer functions to new module LexerFuncs. Moved Lexer.getLocation() to struct Token. Added methods semantic() and error() to class Expression. Added method error() to class Scope.
author Aziz K?ksal <aziz.koeksal@gmail.com>
date Tue, 04 Dec 2007 23:31:20 +0100
parents a7291d3ee9d7
children 4e14cd1b24da
line wrap: on
line diff
--- a/trunk/src/dil/Expressions.d	Mon Dec 03 22:44:27 2007 +0100
+++ b/trunk/src/dil/Expressions.d	Tue Dec 04 23:31:20 2007 +0100
@@ -8,6 +8,7 @@
 import dil.Types;
 import dil.Declarations;
 import dil.Statements;
+import dil.Scope;
 
 abstract class Expression : Node
 {
@@ -15,6 +16,17 @@
   {
     super(NodeCategory.Expression);
   }
+
+  Expression semantic(Scope scop)
+  {
+    return null;
+  }
+
+  import dil.Messages;
+  void error(Scope scop, MID mid)
+  {
+    scop.error(this.begin, mid);
+  }
 }
 
 class EmptyExpression : Expression
@@ -772,6 +784,22 @@
     addChild(expr);
     this.expr = expr;
   }
+
+  // import dil.Parser;
+  Expression semantic(Scope scop)
+  {
+    // TODO:
+    /+
+    auto expr = this.expr.semantic(scop);
+    auto strExpr = Cast!(StringExpression)(expr);
+    // if (strExpr is null)
+    //  error(scop, MID.MixinExpressionMustBeString);
+    auto parser = new Parser(strExpr.getString(), "", scop.infoMan);
+    expr = parser.start2();
+    return expr;
+    +/
+    return null;
+  }
 }
 
 class ImportExpression : Expression