Get() public static method

public static Get ( string name ) : Symbol
name string
return Symbol
Beispiel #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));
        }