public override IVecValue VisitLogRel([NotNull] VectorizeParser.LogRelContext context) { var lhs = context.lhs.Accept(this); var rhs = context.rhs.Accept(this); switch (context.op.Text) { case "<": return(lhs.IsLesserThan(rhs)); case "<=": return(lhs.IsLesserOrEqualTo(rhs)); case ">": return(lhs.IsGreaterThan(rhs)); case ">=": return(lhs.IsGreaterOrEqualTo(rhs)); } throw new InvalidOperationException($"Unknown operator '{context.op.Text}'"); }
/// <summary> /// Exit a parse tree produced by the <c>LogRel</c> /// labeled alternative in <see cref="VectorizeParser.expression"/>. /// <para>The default implementation does nothing.</para> /// </summary> /// <param name="context">The parse tree.</param> public virtual void ExitLogRel([NotNull] VectorizeParser.LogRelContext context) { }
/// <summary> /// Visit a parse tree produced by the <c>LogRel</c> /// labeled alternative in <see cref="VectorizeParser.expression"/>. /// <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 VisitLogRel([NotNull] VectorizeParser.LogRelContext context) { return(VisitChildren(context)); }