view trunk/src/dil/SymbolTable.d @ 564:3c867a683258

Fixed VariableDeclaration.semantic().
author Aziz K?ksal <aziz.koeksal@gmail.com>
date Fri, 28 Dec 2007 22:32:32 +0100
parents b0533550d64c
children de365ddcfbd4
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
{
  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;
  }
}