Exemple #1
0
        public bool EvaluateDynamic(string evaluationText, DynamicBaseClass objectValue)
        {
            ExpressionEvaluatorLexer  expressionEvaluatorLexer  = new ExpressionEvaluatorLexer(evaluationText, 1);
            ExpressionEvaluatorParser expressionEvaluatorParser = new ExpressionEvaluatorParser(expressionEvaluatorLexer);
            var AbstractSyntaxTreeNodeList = expressionEvaluatorParser.BuildParseTree();
            ExpressionEvaluatorExecutor expressionEvaluator = new ExpressionEvaluatorExecutor();
            var result = expressionEvaluator.EvaluateDynamic(AbstractSyntaxTreeNodeList, expressionEvaluatorParser.SymbolTable, objectValue);

            return(result);
        }
Exemple #2
0
        public bool ValidateExpressionRulesAll(DynamicBaseClass value, Rule[] rules)
        {
            Evaluator evaluator = new Evaluator();

            foreach (var rule in rules)
            {
                if (rule.ProcessingRule != string.Empty)
                {
                    if (!evaluator.EvaluateDynamic(rule.ProcessingRule, value))
                    {
                        return(false);
                    }
                }
            }
            return(true);
        }