changeset 680:6b3e397229c5

Renamed Statements, Declarations and EnumMember. Statements -> CompoundStatement. Declarations -> CompoundDeclaration. EnumMember -> EnumMemberDeclaration.
author Aziz K?ksal <aziz.koeksal@gmail.com>
date Fri, 18 Jan 2008 23:59:41 +0100
parents ff6971637f88
children 95a3c28c0f64
files trunk/src/cmd/Generate.d trunk/src/dil/ast/Declarations.d trunk/src/dil/ast/DefaultVisitor.d trunk/src/dil/ast/Expressions.d trunk/src/dil/ast/NodesEnum.d trunk/src/dil/ast/Statements.d trunk/src/dil/doc/Doc.d trunk/src/dil/parser/ImportParser.d trunk/src/dil/parser/Parser.d trunk/src/dil/semantic/Module.d trunk/src/dil/semantic/Pass1.d
diffstat 11 files changed, 50 insertions(+), 54 deletions(-) [+]
line wrap: on
line diff
--- a/trunk/src/cmd/Generate.d	Fri Jan 18 23:40:12 2008 +0100
+++ b/trunk/src/cmd/Generate.d	Fri Jan 18 23:59:41 2008 +0100
@@ -97,16 +97,12 @@
   {
   alias NodeCategory NC;
   case NC.Declaration:
-    if (node.kind == NodeKind.Declarations ||
-        node.kind == NodeKind.EnumMember)
-      break;
     suffixLength = "Declaration".length;
     break;
   case NC.Statement:
     switch (node.kind)
     {
-    case NodeKind.Statements,
-         NodeKind.CatchBody,
+    case NodeKind.CatchBody,
          NodeKind.FinallyBody,
          NodeKind.FunctionBody,
          NodeKind.AsmInstruction,
--- a/trunk/src/dil/ast/Declarations.d	Fri Jan 18 23:40:12 2008 +0100
+++ b/trunk/src/dil/ast/Declarations.d	Fri Jan 18 23:59:41 2008 +0100
@@ -15,7 +15,7 @@
 import dil.Enums;
 import common;
 
-class Declarations : Declaration
+class CompoundDeclaration : Declaration
 {
   this()
   {
@@ -28,7 +28,7 @@
     addChild(d);
   }
 
-  void opCatAssign(Declarations ds)
+  void opCatAssign(CompoundDeclaration ds)
   {
     addChildren(ds.children);
   }
@@ -159,8 +159,8 @@
 {
   Identifier* name;
   TypeNode baseType;
-  EnumMember[] members;
-  this(Identifier* name, TypeNode baseType, EnumMember[] members, bool hasBody)
+  EnumMemberDeclaration[] members;
+  this(Identifier* name, TypeNode baseType, EnumMemberDeclaration[] members, bool hasBody)
   {
     super.hasBody = hasBody;
     mixin(set_kind);
@@ -175,7 +175,7 @@
   Enum symbol;
 }
 
-class EnumMember : Declaration
+class EnumMemberDeclaration : Declaration
 {
   Identifier* name;
   Expression value;
@@ -193,8 +193,8 @@
 {
   Identifier* name;
   TemplateParameters tparams;
-  Declarations decls;
-  this(Identifier* name, TemplateParameters tparams, Declarations decls)
+  CompoundDeclaration decls;
+  this(Identifier* name, TemplateParameters tparams, CompoundDeclaration decls)
   {
     super.hasBody = decls !is null;
     this.name = name;
@@ -206,7 +206,7 @@
 class ClassDeclaration : AggregateDeclaration
 {
   BaseClassType[] bases;
-  this(Identifier* name, TemplateParameters tparams, BaseClassType[] bases, Declarations decls)
+  this(Identifier* name, TemplateParameters tparams, BaseClassType[] bases, CompoundDeclaration decls)
   {
     super(name, tparams, decls);
     mixin(set_kind);
@@ -223,7 +223,7 @@
 class InterfaceDeclaration : AggregateDeclaration
 {
   BaseClassType[] bases;
-  this(Identifier* name, TemplateParameters tparams, BaseClassType[] bases, Declarations decls)
+  this(Identifier* name, TemplateParameters tparams, BaseClassType[] bases, CompoundDeclaration decls)
   {
     super(name, tparams, decls);
     mixin(set_kind);
@@ -242,7 +242,7 @@
 class StructDeclaration : AggregateDeclaration
 {
   uint alignSize;
-  this(Identifier* name, TemplateParameters tparams, Declarations decls)
+  this(Identifier* name, TemplateParameters tparams, CompoundDeclaration decls)
   {
     super(name, tparams, decls);
     mixin(set_kind);
@@ -260,7 +260,7 @@
 
 class UnionDeclaration : AggregateDeclaration
 {
-  this(Identifier* name, TemplateParameters tparams, Declarations decls)
+  this(Identifier* name, TemplateParameters tparams, CompoundDeclaration decls)
   {
     super(name, tparams, decls);
     mixin(set_kind);
@@ -488,8 +488,8 @@
 {
   Identifier* name;
   TemplateParameters tparams;
-  Declarations decls;
-  this(Identifier* name, TemplateParameters tparams, Declarations decls)
+  CompoundDeclaration decls;
+  this(Identifier* name, TemplateParameters tparams, CompoundDeclaration decls)
   {
     super.hasBody = true;
     mixin(set_kind);
--- a/trunk/src/dil/ast/DefaultVisitor.d	Fri Jan 18 23:40:12 2008 +0100
+++ b/trunk/src/dil/ast/DefaultVisitor.d	Fri Jan 18 23:59:41 2008 +0100
@@ -28,7 +28,7 @@
   static if (is(T : Declaration))
   {
     alias T D;
-    static if (is(D == Declarations))
+    static if (is(D == CompoundDeclaration))
       foreach (node; d.children)
         visitN(node);
     //EmptyDeclaration,
@@ -44,7 +44,7 @@
       foreach (member; d.members)
         visitD(member);
     }
-    static if (is(D == EnumMember))
+    static if (is(D == EnumMemberDeclaration))
       d.value && visitE(d.value);
     static if (is(D == ClassDeclaration) || is( D == InterfaceDeclaration))
     {
@@ -194,7 +194,7 @@
   static if (is(T : Statement))
   {
     alias T S;
-    static if (is(S == Statements))
+    static if (is(S == CompoundStatement))
       foreach (node; s.children)
         visitS(cast(Statement)cast(void*)node);
     //IllegalStatement has no subnodes.
--- a/trunk/src/dil/ast/Expressions.d	Fri Jan 18 23:40:12 2008 +0100
+++ b/trunk/src/dil/ast/Expressions.d	Fri Jan 18 23:59:41 2008 +0100
@@ -483,8 +483,8 @@
   Expression[] newArgs;
   BaseClassType[] bases;
   Expression[] ctorArgs;
-  Declarations decls;
-  this(/*Expression e, */Expression[] newArgs, BaseClassType[] bases, Expression[] ctorArgs, Declarations decls)
+  CompoundDeclaration decls;
+  this(/*Expression e, */Expression[] newArgs, BaseClassType[] bases, Expression[] ctorArgs, CompoundDeclaration decls)
   {
     /*super(e);*/
     mixin(set_kind);
--- a/trunk/src/dil/ast/NodesEnum.d	Fri Jan 18 23:40:12 2008 +0100
+++ b/trunk/src/dil/ast/NodesEnum.d	Fri Jan 18 23:59:41 2008 +0100
@@ -17,7 +17,7 @@
 /// Array of class names that inherit from Node.
 static const char[][] classNames = [
   // Declarations:
-  "Declarations",
+  "CompoundDeclaration",
   "EmptyDeclaration",
   "IllegalDeclaration",
   "ModuleDeclaration",
@@ -25,7 +25,7 @@
   "AliasDeclaration",
   "TypedefDeclaration",
   "EnumDeclaration",
-  "EnumMember",
+  "EnumMemberDeclaration",
   "ClassDeclaration",
   "InterfaceDeclaration",
   "StructDeclaration",
@@ -53,7 +53,7 @@
   "MixinDeclaration",
 
   // Statements:
-  "Statements",
+  "CompoundStatement",
   "IllegalStatement",
   "EmptyStatement",
   "FunctionBody",
--- a/trunk/src/dil/ast/Statements.d	Fri Jan 18 23:40:12 2008 +0100
+++ b/trunk/src/dil/ast/Statements.d	Fri Jan 18 23:59:41 2008 +0100
@@ -12,7 +12,7 @@
 import dil.ast.Parameters;
 import dil.lexer.IdTable;
 
-class Statements : Statement
+class CompoundStatement : Statement
 {
   this()
   {
@@ -418,8 +418,8 @@
 
 class AsmStatement : Statement
 {
-  Statements statements;
-  this(Statements statements)
+  CompoundStatement statements;
+  this(CompoundStatement statements)
   {
     mixin(set_kind);
     addChild(statements);
--- a/trunk/src/dil/doc/Doc.d	Fri Jan 18 23:40:12 2008 +0100
+++ b/trunk/src/dil/doc/Doc.d	Fri Jan 18 23:59:41 2008 +0100
@@ -34,13 +34,13 @@
         token.kind == TOK.RBrace ||
         token.kind == TOK.Semicolon ||
         token.kind == TOK.HEAD ||
-        (node.kind == NodeKind.EnumMember && token.kind == TOK.Comma))
+        (node.kind == NodeKind.EnumMemberDeclaration && token.kind == TOK.Comma))
       break;
 
     if (token.kind == TOK.Comment)
     {
       // Check that this comment doesn't belong to the previous declaration.
-      if (node.kind == NodeKind.EnumMember && token.kind == TOK.Comma)
+      if (node.kind == NodeKind.EnumMemberDeclaration && token.kind == TOK.Comma)
         break;
       switch (token.prev.kind)
       {
@@ -56,7 +56,7 @@
   token = node.end.next;
   if (token.kind == TOK.Comment && isDocComment(token))
     comments ~= token;
-  else if (node.kind == NodeKind.EnumMember)
+  else if (node.kind == NodeKind.EnumMemberDeclaration)
   {
     token = node.end.nextNWS;
     if (token.kind == TOK.Comma)
--- a/trunk/src/dil/parser/ImportParser.d	Fri Jan 18 23:40:12 2008 +0100
+++ b/trunk/src/dil/parser/ImportParser.d	Fri Jan 18 23:59:41 2008 +0100
@@ -20,9 +20,9 @@
     super(srcText, fileName);
   }
 
-  override Declarations start()
+  override CompoundDeclaration start()
   {
-    auto decls = new Declarations;
+    auto decls = new CompoundDeclaration;
     super.init();
     if (token.kind == T.Module)
       decls ~= parseModuleDeclaration();
--- a/trunk/src/dil/parser/Parser.d	Fri Jan 18 23:40:12 2008 +0100
+++ b/trunk/src/dil/parser/Parser.d	Fri Jan 18 23:59:41 2008 +0100
@@ -73,11 +73,11 @@
   /++
     Start the parser and return the parsed Declarations.
   +/
-  Declarations start()
+  CompoundDeclaration start()
   {
     init();
     auto begin = token;
-    auto decls = new Declarations;
+    auto decls = new CompoundDeclaration;
     if (token.kind == T.Module)
       decls ~= parseModuleDeclaration();
     decls.addOptChildren(parseDeclarationDefinitions());
@@ -204,7 +204,7 @@
         { }
         { DeclDefs }
   +/
-  Declarations parseDeclarationDefinitionsBody()
+  CompoundDeclaration parseDeclarationDefinitionsBody()
   {
     // Save attributes.
     auto linkageType  = this.linkageType;
@@ -217,7 +217,7 @@
 
     // Parse body.
     auto begin = token;
-    auto decls = new Declarations;
+    auto decls = new CompoundDeclaration;
     require(T.LBrace);
     while (token.kind != T.RBrace && token.kind != T.EOF)
       decls ~= parseDeclarationDefinition();
@@ -405,7 +405,7 @@
     case T.LBrace:
       auto begin = token;
       nT();
-      auto decls = new Declarations;
+      auto decls = new CompoundDeclaration;
       while (token.kind != T.RBrace && token.kind != T.EOF)
         decls ~= parseDeclarationDefinition();
       require(T.RBrace);
@@ -416,7 +416,7 @@
         goto default;
       nT();
       auto begin = token;
-      auto decls = new Declarations;
+      auto decls = new CompoundDeclaration;
       while (token.kind != T.RBrace && token.kind != T.EOF)
         decls ~= parseDeclarationDefinition();
       d = set(decls, begin);
@@ -995,7 +995,7 @@
 
     Identifier* enumName;
     Type baseType;
-    EnumMember[] members;
+    EnumMemberDeclaration[] members;
     bool hasBody;
 
     enumName = optionalIdentifier();
@@ -1019,7 +1019,7 @@
         else
           value = null;
 
-        members ~= set(new EnumMember(name, value), begin);
+        members ~= set(new EnumMemberDeclaration(name, value), begin);
 
         if (token.kind != T.Comma)
           break;
@@ -1041,7 +1041,7 @@
     Identifier* className;
     TemplateParameters tparams;
     BaseClassType[] bases;
-    Declarations decls;
+    CompoundDeclaration decls;
 
     className = requireIdentifier(MSG.ExpectedClassName);
 
@@ -1102,7 +1102,7 @@
     Identifier* name;
     TemplateParameters tparams;
     BaseClassType[] bases;
-    Declarations decls;
+    CompoundDeclaration decls;
 
     name = requireIdentifier(MSG.ExpectedInterfaceName);
 
@@ -1130,7 +1130,7 @@
 
     Identifier* name;
     TemplateParameters tparams;
-    Declarations decls;
+    CompoundDeclaration decls;
 
     name = optionalIdentifier();
 
@@ -1422,11 +1422,11 @@
   + Statement parsing methods  +
   +++++++++++++++++++++++++++++/
 
-  Statements parseStatements()
+  CompoundStatement parseStatements()
   {
     auto begin = token;
     require(T.LBrace);
-    auto statements = new Statements();
+    auto statements = new CompoundStatement();
     while (token.kind != T.RBrace && token.kind != T.EOF)
       statements ~= parseStatement();
     require(T.RBrace);
@@ -1461,7 +1461,7 @@
       else
         expected(T.Struct);
 
-      d = new AlignDeclaration(size, structDecl ? cast(Declaration)structDecl : new Declarations);
+      d = new AlignDeclaration(size, structDecl ? cast(Declaration)structDecl : new CompoundDeclaration);
       goto LreturnDeclarationStatement;
       /+ Not applicable for statements.
          T.Private, T.Package, T.Protected, T.Public, T.Export,
@@ -1694,7 +1694,7 @@
     Statement s;
     if (skipped(T.LBrace))
     {
-      auto ss = new Statements();
+      auto ss = new CompoundStatement();
       while (token.kind != T.RBrace && token.kind != T.EOF)
         ss ~= parseStatement();
       require(T.RBrace);
@@ -1978,7 +1978,7 @@
   {
     // This function is similar to parseNoScopeStatement()
     auto begin = token;
-    auto s = new Statements();
+    auto s = new CompoundStatement();
     while (token.kind != T.Case &&
            token.kind != T.Default &&
            token.kind != T.RBrace &&
@@ -2275,7 +2275,7 @@
     assert(token.kind == T.Asm);
     nT(); // Skip asm keyword.
     require(T.LBrace);
-    auto ss = new Statements;
+    auto ss = new CompoundStatement;
     while (token.kind != T.RBrace && token.kind != T.EOF)
       ss ~= parseAsmInstruction();
     require(T.RBrace);
--- a/trunk/src/dil/semantic/Module.d	Fri Jan 18 23:40:12 2008 +0100
+++ b/trunk/src/dil/semantic/Module.d	Fri Jan 18 23:59:41 2008 +0100
@@ -28,7 +28,7 @@
   string packageName;
   string moduleName;
 
-  Declarations root; /// The root of the AST.
+  CompoundDeclaration root; /// The root of the AST.
   ImportDeclaration[] imports;
   ModuleDeclaration moduleDecl;
   private Parser parser;
--- a/trunk/src/dil/semantic/Pass1.d	Fri Jan 18 23:40:12 2008 +0100
+++ b/trunk/src/dil/semantic/Pass1.d	Fri Jan 18 23:59:41 2008 +0100
@@ -62,7 +62,7 @@
 
 override
 {
-  Declaration visit(Declarations d)
+  Declaration visit(CompoundDeclaration d)
   {
     foreach (node; d.children)
     {
@@ -151,7 +151,7 @@
     return ed;
   }
 
-  Declaration visit(EnumMember)
+  Declaration visit(EnumMemberDeclaration)
   { return null; }
 
   Declaration visit(ClassDeclaration d)