Exemplo n.º 1
0
        /// <summary>
        /// Returns true if this node satisfies the atomic predicate.
        /// </summary>
        protected virtual bool EvalAtom(ASTQueries.NodePredAtom pred, ChildContextKind context, int absPos, int relPos)
        {
            if (pred.PredicateKind == NodePredicateKind.False ||
                (pred.TargetKind != NodeKind.AnyNodeKind && pred.TargetKind != NodeKind))
            {
                return(false);
            }

            if (pred.ChildContext != ChildContextKind.AnyChildContext && pred.ChildContext != context)
            {
                return(false);
            }

            if (pred.ChildContext == ChildContextKind.AnyChildContext &&
                (absPos < pred.ChildIndexLower || absPos > pred.ChildIndexUpper))
            {
                return(false);
            }

            if (pred.ChildContext != ChildContextKind.AnyChildContext &&
                (relPos < pred.ChildIndexLower || relPos > pred.ChildIndexUpper))
            {
                return(false);
            }

            return(true);
        }
Exemplo n.º 2
0
        protected override bool EvalAtom(ASTQueries.NodePredAtom pred, ChildContextKind context, int absPos, int relPos)
        {
            if (!base.EvalAtom(pred, context, absPos, relPos))
            {
                return(false);
            }

            return(pred.AttributePredicate == null ? true : pred.AttributePredicate(AttributeKind.Name, Name));
        }
Exemplo n.º 3
0
        protected override bool EvalAtom(ASTQueries.NodePredAtom pred, ChildContextKind context, int absPos, int relPos)
        {
            if (!base.EvalAtom(pred, context, absPos, relPos))
            {
                return(false);
            }

            if (pred.AttributePredicate == null)
            {
                return(true);
            }

            return(pred.AttributePredicate(AttributeKind.Raw, Raw) &&
                   pred.AttributePredicate(AttributeKind.CnstKind, CnstKind));
        }