view trunk/src/dil/SymbolTable.d @ 589:de365ddcfbd4

Moved dil.Symbol to dil.semantic.Symbol.
author Aziz K?ksal <aziz.koeksal@gmail.com>
date Sat, 05 Jan 2008 23:40:54 +0100
parents 3c867a683258
children
line wrap: on
line source

/++
  Author: Aziz Köksal
  License: GPL3
+/
module dil.SymbolTable;

import dil.semantic.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;
  }
}