Esempio n. 1
0
        /// <summary>
        /// Evaluates the given expression if it's a simple expression else it returns null
        /// </summary>
        /// <param name="rootScope"></param>
        /// <param name="expr"></param>
        /// <returns></returns>
        internal static ILanguageValue EvaluateExpressionIfSimple(LanguageScope rootScope, ILanguageExpression expr)
        {
            if (!expr.IsSimpleExpression)
            {
                return(null);
            }

            var evaluator = new GMacExpressionEvaluator(rootScope);

            return(expr.AcceptVisitor(evaluator));
        }
Esempio n. 2
0
        /// <summary>
        /// Evaluate the given expression inside the given scope
        /// </summary>
        /// <param name="rootScope"></param>
        /// <param name="expr"></param>
        /// <returns></returns>
        internal static ILanguageValue EvaluateExpression(LanguageScope rootScope, ILanguageExpression expr)
        {
            var evaluator = new GMacExpressionEvaluator(rootScope);

            return(expr.AcceptVisitor(evaluator));
        }