Mercurial > projects > dil
changeset 556:19554e79e6d2
Added module dil.SymbolTable.
author | Aziz K?ksal <aziz.koeksal@gmail.com> |
---|---|
date | Mon, 24 Dec 2007 16:12:41 +0100 |
parents | d9e328c3bab9 |
children | c5a05e70911f |
files | trunk/src/dil/SymbolTable.d |
diffstat | 1 files changed, 25 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/trunk/src/dil/SymbolTable.d Mon Dec 24 16:12:41 2007 +0100 @@ -0,0 +1,25 @@ +/++ + Author: Aziz Köksal + License: GPL3 ++/ +module dil.SymbolTable; + +import dil.Symbol; +import dil.Identifier; +import common; + +/++ + Maps an identifier string to a Symbol. ++/ +class SymbolTable +{ + protected Symbol[char[]] table; + + /// Look up ident in the table. + Symbol lookup(Identifier* ident) + { + assert(ident !is null); + auto psym = ident.str in table; + return psym ? *psym : null; + } +}