# HG changeset patch # User aziz # Date 1186383303 0 # Node ID dcce141c97f5f51ae7dafb3dcbc23b2529ce15ab # Parent e095ec570c310bc264ad3f805a75e10ae3d91a21 - Added module Identifier. diff -r e095ec570c31 -r dcce141c97f5 trunk/src/Identifier.d --- /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; + } +}