diff trunk/src/dil/ast/NodesEnum.d @ 635:b2fc028d8b55

Added class Visitor. Moved enums NodeCategory and NodeKind to new module dil.ast.NodesEnum. Commented out some version(D2) statements. Added new module dil.semantic.Pass1.
author Aziz K?ksal <aziz.koeksal@gmail.com>
date Sun, 13 Jan 2008 21:53:01 +0100
parents
children 05645f5613c1
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trunk/src/dil/ast/NodesEnum.d	Sun Jan 13 21:53:01 2008 +0100
@@ -0,0 +1,232 @@
+/++
+  Author: Aziz Köksal
+  License: GPL3
++/
+module dil.ast.NodesEnum;
+
+enum NodeCategory
+{
+  Declaration,
+  Statement,
+  Expression,
+  Type,
+  Other
+}
+
+/// Array of class names that inherit from Node.
+static const char[][] classNames = [
+  // Declarations:
+  "Declarations",
+  "EmptyDeclaration",
+  "IllegalDeclaration",
+  "ModuleDeclaration",
+  "ImportDeclaration",
+  "AliasDeclaration",
+  "TypedefDeclaration",
+  "EnumDeclaration",
+  "ClassDeclaration",
+  "InterfaceDeclaration",
+  "StructDeclaration",
+  "UnionDeclaration",
+  "ConstructorDeclaration",
+  "StaticConstructorDeclaration",
+  "DestructorDeclaration",
+  "StaticDestructorDeclaration",
+  "FunctionDeclaration",
+  "VariableDeclaration",
+  "InvariantDeclaration",
+  "UnittestDeclaration",
+  "DebugDeclaration",
+  "VersionDeclaration",
+  "StaticIfDeclaration",
+  "StaticAssertDeclaration",
+  "TemplateDeclaration",
+  "NewDeclaration",
+  "DeleteDeclaration",
+  "AttributeDeclaration",
+  "ProtectionDeclaration",
+  "StorageClassDeclaration",
+  "LinkageDeclaration",
+  "AlignDeclaration",
+  "PragmaDeclaration",
+  "MixinDeclaration",
+
+  // Statements:
+  "Statements",
+  "IllegalStatement",
+  "EmptyStatement",
+  "ScopeStatement",
+  "LabeledStatement",
+  "ExpressionStatement",
+  "DeclarationStatement",
+  "IfStatement",
+//   "ConditionalStatement",
+  "WhileStatement",
+  "DoWhileStatement",
+  "ForStatement",
+  "ForeachStatement",
+  "ForeachRangeStatement", // D2.0
+  "SwitchStatement",
+  "CaseStatement",
+  "DefaultStatement",
+  "ContinueStatement",
+  "BreakStatement",
+  "ReturnStatement",
+  "GotoStatement",
+  "WithStatement",
+  "SynchronizedStatement",
+  "TryStatement",
+  "CatchBody",
+  "FinallyBody",
+  "ScopeGuardStatement",
+  "ThrowStatement",
+  "VolatileStatement",
+  "AsmStatement",
+  "AsmInstruction",
+  "AsmAlignStatement",
+  "IllegalAsmInstruction",
+  "PragmaStatement",
+  "MixinStatement",
+  "StaticIfStatement",
+  "StaticAssertStatement",
+  "DebugStatement",
+  "VersionStatement",
+
+  // Expressions:
+  "EmptyExpression",
+  "BinaryExpression",
+  "CondExpression",
+  "CommaExpression",
+  "OrOrExpression",
+  "AndAndExpression",
+  "OrExpression",
+  "XorExpression",
+  "AndExpression",
+  "CmpExpression",
+  "EqualExpression",
+  "IdentityExpression",
+  "RelExpression",
+  "InExpression",
+  "LShiftExpression",
+  "RShiftExpression",
+  "URShiftExpression",
+  "PlusExpression",
+  "MinusExpression",
+  "CatExpression",
+  "MulExpression",
+  "DivExpression",
+  "ModExpression",
+  "AssignExpression",
+  "LShiftAssignExpression",
+  "RShiftAssignExpression",
+  "URShiftAssignExpression",
+  "OrAssignExpression",
+  "AndAssignExpression",
+  "PlusAssignExpression",
+  "MinusAssignExpression",
+  "DivAssignExpression",
+  "MulAssignExpression",
+  "ModAssignExpression",
+  "XorAssignExpression",
+  "CatAssignExpression",
+  "UnaryExpression",
+  "AddressExpression",
+  "PreIncrExpression",
+  "PreDecrExpression",
+  "PostIncrExpression",
+  "PostDecrExpression",
+  "DerefExpression",
+  "SignExpression",
+  "NotExpression",
+  "CompExpression",
+  "CallExpression",
+  "NewExpression",
+  "NewAnonClassExpression",
+  "DeleteExpression",
+  "CastExpression",
+  "IndexExpression",
+  "SliceExpression",
+  "ModuleScopeExpression",
+  "IdentifierExpression",
+  "SpecialTokenExpression",
+  "DotExpression",
+  "TemplateInstanceExpression",
+  "ThisExpression",
+  "SuperExpression",
+  "NullExpression",
+  "DollarExpression",
+  "BoolExpression",
+  "IntExpression",
+  "RealExpression",
+  "ComplexExpression",
+  "CharExpression",
+  "StringExpression",
+  "ArrayLiteralExpression",
+  "AArrayLiteralExpression",
+  "AssertExpression",
+  "MixinExpression",
+  "ImportExpression",
+  "TypeofExpression",
+  "TypeDotIdExpression",
+  "TypeidExpression",
+  "IsExpression",
+  "FunctionLiteralExpression",
+  "TraitsExpression", // D2.0
+  "VoidInitializer",
+  "ArrayInitializer",
+  "StructInitializer",
+  "AsmTypeExpression",
+  "AsmOffsetExpression",
+  "AsmSegExpression",
+  "AsmPostBracketExpression",
+  "AsmBracketExpression",
+  "AsmLocalSizeExpression",
+  "AsmRegisterExpression",
+
+  // Types:
+  "UndefinedType",
+  "IntegralType",
+  "QualifiedType",
+  "ModuleScopeType",
+  "IdentifierType",
+  "TypeofType",
+  "TemplateInstanceType",
+  "PointerType",
+  "ArrayType",
+  "FunctionType",
+  "DelegateType",
+  "CFuncPointerType",
+  "ConstType", // D2.0
+  "InvariantType", // D2.0
+
+  // Other:
+  "FunctionBody",
+  "Parameter",
+  "Parameters",
+  "BaseClass",
+  "TemplateAliasParameter",
+  "TemplateTypeParameter",
+  "TemplateThisParameter", // D2.0
+  "TemplateValueParameter",
+  "TemplateTupleParameter",
+  "TemplateParameters",
+  "TemplateArguments",
+  "EnumMember",
+];
+
+char[] generateNodeKindMembers()
+{
+  char[] text;
+  foreach (className; classNames)
+    text ~= className ~ ",";
+  return text;
+}
+// pragma(msg, generateNodeKindMembers());
+
+// enum NodeKind;
+mixin(
+  "enum NodeKind"
+  "{"
+    ~ generateNodeKindMembers ~
+  "}"
+);