// NOTE: This is one ugly piece of internal hackery. // Needed for nil and t for now. public void InternSpecial(string name, Symbol symbol) { if (symbols.ContainsKey(name)) symbols[name] = symbol; else symbols.Add(name, symbol); }
public Symbol Intern(string name) { // TODO This is not quite elegant. Maybe a hash table? Any better ideas? Symbol symbol; if (Reader.TryGetSpecialSymbol(name, out symbol) || symbols.TryGetValue(name, out symbol)) return symbol; symbol = new Symbol(name); symbols.Add(name, symbol); return symbol; }
public static bool TryGetSpecialSymbol(string name, out Symbol symbol) { return SpecialSymbols.TryGetValue(name, out symbol); }