changeset 274:dcce141c97f5

- Added module Identifier.
author aziz
date Mon, 06 Aug 2007 06:55:03 +0000
parents e095ec570c31
children e8de572e4d01
files trunk/src/Identifier.d
diffstat 1 files changed, 30 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trunk/src/Identifier.d	Mon Aug 06 06:55:03 2007 +0000
@@ -0,0 +1,30 @@
+/++
+  Author: Aziz Köksal
+  License: GPL3
++/
+module Identifier;
+import Token;
+
+struct Identifier
+{
+  TOK type;
+  string str;
+
+  static Identifier opCall(TOK type, string str)
+  {
+    Identifier i;
+    i.type = type;
+    i.str = str;
+    return i;
+  }
+
+  uint toHash()
+  {
+    uint hash;
+    foreach(c; str) {
+      hash *= 9;
+      hash += c;
+    }
+    return hash;
+  }
+}