Exemplo n.º 1
0
        static void Main(string[] args)
        {
            h = new Hashtable();
            h.Add("hello", "world");
            //Console.Out.WriteLine(CSE.CsEval.Eval(null, "3 + 4"));
            //Test(typeof(byte), 300);

            CsEval.EvalEnvironment = new TestProg();

            Console.Out.Write(">> ");
            string exp = Console.In.ReadLine();

            while (exp != "")
            {
                try {
                    CsEvaluator evaluator = CsEval.GetEvaluator(exp);
                    object      result    = CsEval.Eval(evaluator);

                    if (result == null)
                    {
                        Console.Out.WriteLine(Environment.NewLine + "Returned: null");
                    }
                    else
                    {
                        Console.Out.WriteLine(Environment.NewLine + result.ToString());
                    }
                }
                catch (Exception e) {
                    Console.Out.WriteLine(Environment.NewLine + e.Message);
                }

                Console.Out.Write(Environment.NewLine + ">> ");
                exp = Console.In.ReadLine();
            }
        }