Exemple #1
0
        /// <summary>
        /// Evalutates an expression supplied as a <see cref="System.String"/> without persistence of context.
        /// </summary>
        /// <param name="expression">A <see cref="System.String"/> expression to evaluate.</param>
        /// <returns>An <see cref="System.Object"/> that represents the result of evaluation.</returns>
        public static object It(string expression)
        {
            var tree   = SyntaxTree.ParseString(expression);
            var global = new Scope();

            BuiltIn.IntializeScope(global);
            var visitor = Visitor.Create(global);

            tree.Root.Accept(visitor);
            return(visitor.Result);
        }
Exemple #2
0
 /// <summary>
 /// Creates an instance of <see cref="ExpressionEngine.Context"/>.
 /// </summary>
 public Context()
 {
     _global = new Scope();
     BuiltIn.IntializeScope(_global);
 }