diff trunk/src/Types.d @ 95:0eb4c8a5b32b

- Added TOK.Invalid. - Moved STC as StorageClass to module Type. - Added In, Out, Ref, Lazy and Variadic to StorageClass. - Added member 'next' to class Type to represent non-basic types like pointers, arrays etc. - Added class PointerType and ArrayType. - Added class Argument to represent function parameters. - Implemented most of parseBasicType2() and parseParameters().
author aziz
date Fri, 06 Jul 2007 18:37:03 +0000
parents 0fe650a7a8d1
children 538e8b546669
line wrap: on
line diff
--- a/trunk/src/Types.d	Fri Jul 06 15:23:04 2007 +0000
+++ b/trunk/src/Types.d	Fri Jul 06 18:37:03 2007 +0000
@@ -6,12 +6,39 @@
 import Token;
 import Expressions;
 
+enum StorageClass
+{
+  None         = 0,
+  Abstract     = 1,
+  Auto         = 1<<2,
+  Const        = 1<<3,
+  Deprecated   = 1<<4,
+  Extern       = 1<<5,
+  Final        = 1<<6,
+  Invariant    = 1<<7,
+  Override     = 1<<8,
+  Scope        = 1<<9,
+  Static       = 1<<10,
+  Synchronized = 1<<11,
+  In           = 1<<12,
+  Out          = 1<<13,
+  Ref          = 1<<14,
+  Lazy         = 1<<15,
+  Variadic     = 1<<16,
+}
+
 class Type
 {
   TOK type;
+  Type next;
+
   this(TOK type)
+  { this(type, null); }
+
+  this(TOK type, Type next)
   {
     this.type = type;
+    this.next = next;
   }
 }
 
@@ -21,13 +48,13 @@
 
   this(string[] idents)
   {
-    super(TOK.Identifier);
+    super(TOK.Identifier, null);
     this.idents = idents;
   }
 
   this(TOK type)
   {
-    super(type);
+    super(type, null);
   }
 
   void opCatAssign(string ident)
@@ -45,3 +72,21 @@
     this.e = e;
   }
 }
+
+class PointerType : Type
+{
+  this(Type t)
+  {
+    super(TOK.Mul, t);
+  }
+}
+
+class ArrayType : Type
+{
+  Expression e;
+  this(Type t, Expression e)
+  {
+    super(TOK.Invalid, t);
+    this.e = e;
+  }
+}