Mercurial > projects > dil
view src/dil/semantic/SymbolTable.d @ 806:bcb74c9b895c
Moved out files in the trunk folder to the root.
author | Aziz K?ksal <aziz.koeksal@gmail.com> |
---|---|
date | Sun, 09 Mar 2008 00:12:19 +0100 |
parents | trunk/src/dil/semantic/SymbolTable.d@c24be8d4f6ab |
children |
line wrap: on
line source
/++ Author: Aziz Köksal License: GPL3 +/ module dil.semantic.SymbolTable; import dil.semantic.Symbol; import dil.lexer.Identifier; import common; /// Maps an identifier string to a Symbol. struct SymbolTable { Symbol[char[]] table; /// The table data structure. /// Looks up ident in the table. /// Returns: the symbol if there, otherwise null. Symbol lookup(Identifier* ident) { assert(ident !is null); auto psym = ident.str in table; return psym ? *psym : null; } /// Inserts a symbol into the table. void insert(Symbol symbol, Identifier* ident) { table[ident.str] = symbol; } }