view trunk/src/Identifier.d @ 274:dcce141c97f5

- Added module Identifier.
author aziz
date Mon, 06 Aug 2007 06:55:03 +0000
parents
children
line wrap: on
line source

/++
  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;
  }
}