예제 #1
0
		// 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);
		}
예제 #2
0
		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;
		}
예제 #3
0
		public static bool TryGetSpecialSymbol(string name, out Symbol symbol)
		{
			return SpecialSymbols.TryGetValue(name, out symbol);
		}