Exemple #1
0
        public object VisitImplicationExpression(KpExperimentParser.ImplicationExpressionContext context)
        {
            var leftPredicateContext = context.orExpression().FirstOrDefault();
            var rightPredicateCotext = context.orExpression().Skip(1).FirstOrDefault();
            var result = default(IPredicate);

            if (rightPredicateCotext != null)
            {
                result = new BooleanExpression
                {
                    LeftOperand  = VisitOrExpression(leftPredicateContext) as IPredicate,
                    RightOperand = VisitOrExpression(rightPredicateCotext) as IPredicate,
                    Operator     = BooleanOperator.Implication,
                };
            }
            else
            {
                result = VisitOrExpression(leftPredicateContext) as IPredicate;
            }

            return(result);
        }
Exemple #2
0
 /// <summary>
 /// Visit a parse tree produced by <see cref="KpExperimentParser.implicationExpression"/>.
 /// <para>
 /// The default implementation returns the result of calling <see cref="AbstractParseTreeVisitor{Result}.VisitChildren(IRuleNode)"/>
 /// on <paramref name="context"/>.
 /// </para>
 /// </summary>
 /// <param name="context">The parse tree.</param>
 /// <return>The visitor result.</return>
 public virtual Result VisitImplicationExpression([NotNull] KpExperimentParser.ImplicationExpressionContext context)
 {
     return(VisitChildren(context));
 }