Example #1
0
	internal Symbol internConstant(String name,Object val)
		{
		Symbol result = null;
		if(table.ContainsKey(name))
			{
			throw new Exception("Constant: " + name + " already defined");
			}
		table[name] = result = new Constant(name,val);
		return result;
		}
Example #2
0
	internal Symbol internConstant(String name,Object val)
		{
		Symbol result = null;
	    SymbolTable from = this;
        while (from != null)
	    {
            var table = from.table;
            if (table.ContainsKey(name))
            {
                // KHC : just return what the constant alreay is
                //throw new Exception("Constant: " + name + " already defined");
                return (Symbol)(table[name]);
            }
	        from = from.Parent;
	    }
		this.table[name] = result = new Constant(name,val);
		return result;
		}