public override Func <IUser, bool> VisitSwCompare(BoolExprParser.SwCompareContext context) { var attrVal = context.children.Last().GetText().Trim('"'); var(attrType, attrName) = GetAttributeInfo(context.children.First()); return(user => attrType == "profile" ? user.Profile[attrName] != null && user.Profile[attrName].ToString().StartsWith(attrVal) : user.GetNonProfileAttribute(attrName).StartsWith(attrVal)); }
/// <summary> /// Visit a parse tree produced by the <c>swCompare</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 VisitSwCompare([NotNull] BoolExprParser.SwCompareContext context) { return(VisitChildren(context)); }