Mercurial > projects > dil
view trunk/src/dil/Identifier.d @ 505:3bb94ba21490
Refactored a great amount of code.
Changed many declaration types from Token* to Identifier*.
Fix in parseStructInitializer(): append null to idents in else body.
Fixed class Parameter and parseParameterList().
author | Aziz K?ksal <aziz.koeksal@gmail.com> |
---|---|
date | Wed, 12 Dec 2007 02:25:42 +0100 |
parents | 4e14cd1b24da |
children | 4d50267f59c9 |
line wrap: on
line source
/++ Author: Aziz Köksal License: GPL3 +/ module dil.Identifier; import dil.TokensEnum; import dil.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);