Mercurial > projects > dil
view trunk/src/dil/lexer/Identifier.d @ 602:c2e35c83c394
Moved dil.IdentsEnum to dil.lexer.IdentsEnum.
author | Aziz K?ksal <aziz.koeksal@gmail.com> |
---|---|
date | Sun, 06 Jan 2008 00:58:27 +0100 |
parents | 041eae272362 |
children | f58fd84c0d18 |
line wrap: on
line source
/++ Author: Aziz Köksal License: GPL3 +/ module dil.lexer.Identifier; import dil.lexer.TokensEnum; import dil.lexer.IdentsEnum; import common; align(1) struct Identifier { string str; TOK type; ID identID; static Identifier* opCall(string str, TOK type) { auto id = new Identifier; id.str = str; id.type = type; return id; } static Identifier* opCall(string str, TOK type, ID identID) { auto id = new Identifier; id.str = str; id.type = type; id.identID = identID; return id; } uint toHash() { uint hash; foreach(c; str) { hash *= 9; hash += c; } return hash; } } // pragma(msg, Identifier.sizeof.stringof);