public override PredicateNode VisitPredicate(PredicateParser.PredicateContext context) { // OpenParen predicate CloseParen if (context.OpenParen() != null) { return(Visit(context.predicate().First())); } // predicate booleanOperator predicate if (context.booleanOperator() != null) { var booleanOperator = Visit(context.booleanOperator()); booleanOperator.Children.Add(Visit(context.predicate()[0])); booleanOperator.Children.Add(Visit(context.predicate()[1])); return(booleanOperator); } // operand operator operand if (context.@operator() != null) { var @operator = Visit(context.@operator()); @operator.Children.Add(Visit(context.operand()[0])); @operator.Children.Add(Visit(context.operand()[1])); return(@operator); } throw new Exception("Unhandled Predicate"); }
/// <summary> /// Visit a parse tree produced by <see cref="PredicateParser.predicate"/>. /// <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 VisitPredicate([NotNull] PredicateParser.PredicateContext context) { return(VisitChildren(context)); }