예제 #1
0
        public override FilterDefinition <T> VisitIntOp([NotNull] FilterParser.IntOpContext context)
        {
            string id      = context.ID().GetText();
            string integer = context.INT().GetText();

            var op = context.op.Type;

            switch (op)
            {
            case FilterParser.EQ:
                return(_builder.Eq(id, integer));

            case FilterParser.NE:
                return(_builder.Ne(id, integer));

            case FilterParser.GT:
                return(_builder.Gt(id, integer));

            case FilterParser.GE:
                return(_builder.Gte(id, integer));

            case FilterParser.LT:
                return(_builder.Lt(id, integer));

            case FilterParser.LE:
                return(_builder.Lte(id, integer));

            default:
                throw new InvalidOperationException($"Invalid StringOp {context.GetText()}");
            }
        }
예제 #2
0
 /// <summary>
 /// Visit a parse tree produced by the <c>IntOp</c>
 /// labeled alternative in <see cref="FilterParser.expr"/>.
 /// <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 VisitIntOp([NotNull] FilterParser.IntOpContext context)
 {
     return(VisitChildren(context));
 }