BAD.Symbol.Get C# (CSharp) Method

Get() public static method

public static Get ( string name ) : Symbol
name string
return Symbol
        public static Symbol Get(string name)
        {
            Symbol s;
            if (symbols.TryGetValue (name, out s)) {
                return s;
            }
            s = symbols [name] = new Symbol (name);
            return s;
        }

Usage Example

Example #1
0
        static object Atomize(string token)
        {
            if (token.StartsWith("\""))
            {
                return(token);
            }
            if (token == "true")
            {
                return(true);
            }
            if (token == "false")
            {
                return(false);
            }
            if (token == "\n")
            {
                return(EOL);
            }
            if (token == "{")
            {
                return(OPEN);
            }
            if (token == "}")
            {
                return(CLOSE);
            }
            float value;

            if (float.TryParse(token, out value))
            {
                return(value);
            }
            if (token.Contains("."))
            {
                return(new ComponentMethodLookup(token.Split('.')));
            }
            var typeName = GuessTypeName(token);

            try {
                var type = System.Type.GetType("BAD." + typeName, true, true);
                return(System.Activator.CreateInstance(type));
            } catch (System.TypeLoadException) {
                DebugLog("Could not load type: " + typeName + ". Assuming symbol.");
            }
            return(Symbol.Get(token));
        }