Mercurial > projects > dil
view trunk/src/dil/SymbolTable.d @ 562:b0533550d64c
Added semantic() to VariableDeclaration.
Renamed member type to typeNode in VariableDeclaration.
Added insert() and error() to class Scope.
Made class SymbolTable a struct.
Added insert() and lookup() to ScopeSymbol.
Added insert() to Aggregate.
Added semantic() to TypeNode.
author | Aziz K?ksal <aziz.koeksal@gmail.com> |
---|---|
date | Fri, 28 Dec 2007 17:48:47 +0100 |
parents | 19554e79e6d2 |
children | 3c867a683258 |
line wrap: on
line source
/++ Author: Aziz Köksal License: GPL3 +/ module dil.SymbolTable; import dil.Symbol; import dil.Identifier; import common; /++ Maps an identifier string to a Symbol. +/ struct 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; } void insert(Symbol s, Identifier* ident) { table[ident.str] = s; } }