diff trunk/src/dil/Identifier.d @ 502:4e14cd1b24da

Refactored code and added modules related to tabulated Identifiers. Rearranged members of struct Identifier and added new member ID identID. Moved idTableLookup to module dil.IdTable. Renamed module TokenIDs to TokensEnum. Added member Identifier* ident to struct Token. Changed string switchtes in Parser to integer switches using enum ID.
author Aziz K?ksal <aziz.koeksal@gmail.com>
date Tue, 11 Dec 2007 14:19:30 +0100
parents 52447db67938
children 3bb94ba21490
line wrap: on
line diff
--- a/trunk/src/dil/Identifier.d	Sun Dec 09 23:27:40 2007 +0100
+++ b/trunk/src/dil/Identifier.d	Tue Dec 11 14:19:30 2007 +0100
@@ -3,20 +3,24 @@
   License: GPL3
 +/
 module dil.Identifier;
-import dil.Token;
+import dil.TokensEnum;
+import dil.IdentsEnum;
 import common;
 
+align(1)
 struct Identifier
 {
+  string str;
   TOK type;
-  string str;
+  ID identID;
 
-  static Identifier* opCall(TOK type, string str)
+  static Identifier* opCall(string str, TOK type, ID identID = ID.Null)
   {
-    auto i = new Identifier;
-    i.type = type;
-    i.str = str;
-    return i;
+    auto id = new Identifier;
+    id.str = str;
+    id.type = type;
+    id.identID = identID;
+    return id;
   }
 
   uint toHash()
@@ -29,3 +33,4 @@
     return hash;
   }
 }
+// pragma(msg, Identifier.sizeof.stringof);