예제 #1
0
        public override Func <IUser, bool> VisitEqCompare(BoolExprParser.EqCompareContext context)
        {
            var attrVal = context.children.Last().GetText().Trim('"');

            var(attrType, attrName) = GetAttributeInfo(context.children.First());

            return(user =>
                   attrType == "profile"
                    ? user.Profile[attrName]?.ToString() == attrVal
                    : user.GetNonProfileAttribute(attrName) == attrVal);
        }
 /// <summary>
 /// Visit a parse tree produced by the <c>eqCompare</c>
 /// labeled alternative in <see cref="BoolExprParser.attr_comp"/>.
 /// <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 VisitEqCompare([NotNull] BoolExprParser.EqCompareContext context)
 {
     return(VisitChildren(context));
 }