clojure.lang.CljCompiler.Ast.NumberExpr.Parse C# (CSharp) Метод

Parse() публичный статический Метод

public static Parse ( object form ) : clojure.lang.CljCompiler.Ast.Expr
form object
Результат clojure.lang.CljCompiler.Ast.Expr
        public static Expr Parse(object form)
        {
            if (form is int || form is double || form is long)
                return new NumberExpr(form);
            else
                return new ConstantExpr(form);
        }

Usage Example

Пример #1
0
            public Expr Parse(ParserContext pcon, object form)
            {
                int argCount = RT.count(form) - 1;

                if (argCount != 1)
                {
                    IPersistentMap exData = new PersistentArrayMap(new Object[] { FormKey, form });
                    throw new ExceptionInfo("Wrong number of args (" +
                                            argCount +
                                            ") passed to quote",
                                            exData);
                }

                object v = RT.second(form);

                if (v == null)
                {
                    return(Compiler.NilExprInstance);
                }
                else if (v is Boolean)
                {
                    if ((bool)v)
                    {
                        return(Compiler.TrueExprInstance);
                    }
                    else
                    {
                        return(Compiler.FalseExprInstance);
                    }
                }
                else if (Util.IsNumeric(v))
                {
                    return(NumberExpr.Parse(v));
                }
                else if (v is string)
                {
                    return(new StringExpr((String)v));
                }
                else if (v is IPersistentCollection && ((IPersistentCollection)v).count() == 0)
                {
                    return(new EmptyExpr(v));
                }
                else
                {
                    return(new ConstantExpr(v));
                }
            }
All Usage Examples Of clojure.lang.CljCompiler.Ast.NumberExpr::Parse