diff src/parser/Parser.d @ 209:42e663451371

Renamed some of the actions. Declarations now have it's own action.
author Anders Johnsen <skabet@gmail.com>
date Tue, 12 Aug 2008 19:05:17 +0200
parents e0551773a005
children
line wrap: on
line diff
--- a/src/parser/Parser.d	Tue Aug 12 18:21:06 2008 +0200
+++ b/src/parser/Parser.d	Tue Aug 12 19:05:17 2008 +0200
@@ -77,19 +77,19 @@
         switch(peek.type)
         {
             case Tok.Struct:
-                Id type = Id(next());
+                next();
                 Id iden = Id(require(Tok.Identifier));            
-                return parseStruct(type, iden, att);
+                return parseStruct(iden, att);
 
             case Tok.Class:
-                Id type = Id(next());
+                next();
                 Id iden = Id(require(Tok.Identifier));            
-                return parseClass(type, iden, att);
+                return parseClass(iden, att);
 
             case Tok.Interface:
-                Id type = Id(next());
+                next();
                 Id iden = Id(require(Tok.Identifier));
-                return parseInterface(type, iden, att);
+                return parseInterface(iden, att);
 
             case Tok.Alias:
                 next();
@@ -104,13 +104,13 @@
                 {
                     case Tok.Seperator:
                         Token sep = next();
-                        return action.actOnDeclarator(type, iden, null, att);
+                        return action.actOnVarDecl(type, iden, null, att);
 
                     case Tok.Assign:
                         Token assign = next();
                         Exp exp = parseExpression();
                         require(Tok.Seperator);
-                        return action.actOnDeclarator(type, iden, exp, att);
+                        return action.actOnVarDecl(type, iden, exp, att);
 
                     case Tok.OpenParentheses:
                         return parseFunc(type, iden, att);
@@ -119,7 +119,7 @@
                         auto n1 = next();
                         isEOF(type.tok);
                         messages.report(UnexpectedTok, n1.location).arg(n1.get(sm));
-                        return action.actOnDeclarator(type, iden, null, att);
+                        return action.actOnVarDecl(type, iden, null, att);
                 }
                 messages.report(InvalidDeclType, peek.location)
                     .arg(sm.getText(peek.asRange));
@@ -263,9 +263,9 @@
     /**
       Parse interface
      */
-    Decl parseInterface(Id type, Id iden, Attribute att)
+    Decl parseInterface(Id iden, Attribute att)
     {
-        auto decl = action.actOnDeclarator(type, iden, null, att);
+        auto decl = action.actOnInterfaceDecl(iden, att);
 
         if (peek.type == Tok.Colon)
             // SuperInterfaces
@@ -313,9 +313,9 @@
     /**
       Parse class
      */
-    Decl parseClass(Id type, Id iden, Attribute att)
+    Decl parseClass(Id iden, Attribute att)
     {
-        auto decl = action.actOnDeclarator(type, iden, null, att);
+        auto decl = action.actOnClassDecl(iden, att);
 
         if (peek.type == Tok.Colon)
             // BaseClassList - Super class and interfaces(in that order)
@@ -380,9 +380,9 @@
     /**
       Parse struct
      */
-    Decl parseStruct(Id type, Id iden, Attribute att)
+    Decl parseStruct(Id iden, Attribute att)
     {
-        auto decl = action.actOnDeclarator(type, iden, null, att);
+        auto decl = action.actOnStructDecl(iden, att);
 
         require(Tok.OpenBrace);
 
@@ -716,7 +716,7 @@
             init = parseExpression();
         require(Tok.Seperator);
         Attribute att;
-        Decl d = action.actOnDeclarator(type, id, init, att);
+        Decl d = action.actOnVarDecl(type, id, init, att);
         return d;
     }
 
@@ -870,7 +870,7 @@
                             i = parseIdentifier();
 
                         // Act on function type param
-                        decls ~= action.actOnDeclarator(t, i, null, Attribute());
+                        decls ~= action.actOnVarDecl(t, i, null, Attribute());
 
                         if(peek.type == Tok.Comma)
                             next();