public object VisitOrExpression(KpExperimentParser.OrExpressionContext context) { var leftPredicateContext = context.andExpression().FirstOrDefault(); var rightPredicateCotext = context.andExpression().Skip(1).FirstOrDefault(); var result = default(IPredicate); if (rightPredicateCotext != null) { result = new BooleanExpression { LeftOperand = VisitAndExpression(leftPredicateContext) as IPredicate, RightOperand = VisitAndExpression(rightPredicateCotext) as IPredicate, Operator = BooleanOperator.Or, }; } else { result = VisitAndExpression(leftPredicateContext) as IPredicate; } return(result); }
/// <summary> /// Visit a parse tree produced by <see cref="KpExperimentParser.orExpression"/>. /// <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 VisitOrExpression([NotNull] KpExperimentParser.OrExpressionContext context) { return(VisitChildren(context)); }