internal SelectOpcode(OpcodeID id, NodeSelectCriteria criteria, OpcodeFlags flags) : base(id)
 {
     this.criteria = criteria;
     base.flags |= flags | OpcodeFlags.Select;
     if (criteria.IsCompressable && ((base.flags & OpcodeFlags.InitialSelect) == OpcodeFlags.None))
     {
         base.flags |= OpcodeFlags.CompressableSelect;
     }
 }
Пример #2
0
 internal SelectOpcode(OpcodeID id, NodeSelectCriteria criteria, OpcodeFlags flags) : base(id)
 {
     this.criteria = criteria;
     base.flags   |= flags | OpcodeFlags.Select;
     if (criteria.IsCompressable && ((base.flags & OpcodeFlags.InitialSelect) == OpcodeFlags.None))
     {
         base.flags |= OpcodeFlags.CompressableSelect;
     }
 }
Пример #3
0
 internal SelectOpcode(OpcodeID id, NodeSelectCriteria criteria, OpcodeFlags flags)
     : base(id)
 {
     this.criteria = criteria;
     this.flags   |= (flags | OpcodeFlags.Select);
     if (criteria.IsCompressable && (0 == (this.flags & OpcodeFlags.InitialSelect)))
     {
         this.flags |= OpcodeFlags.CompressableSelect;
     }
 }
Пример #4
0
        XPathStepExpr ParseStep()
        {
            QueryAxisType      axis       = this.ParseAxisSpecifier();
            NodeSelectCriteria selectDesc = null;
            bool abbreviatedStep          = false;

            if (QueryAxisType.None != axis)
            {
                // Valid axis specifier - must be followed by a nodeTest
                selectDesc = this.ParseNodeTest(axis);
            }
            else
            {
                // No axis specifier. This could be an abbreviated step - shortcuts for 'self' or 'parent'
                if (null != this.NextToken(XPathTokenID.Period))
                {
                    selectDesc      = new NodeSelectCriteria(QueryAxisType.Self, NodeQName.Empty, QueryNodeType.All);
                    abbreviatedStep = true;
                }
                else if (null != this.NextToken(XPathTokenID.DblPeriod))
                {
                    // A shortcut for parent
                    selectDesc      = new NodeSelectCriteria(QueryAxisType.Parent, NodeQName.Empty, QueryNodeType.Ancestor);
                    abbreviatedStep = true;
                }
                else
                {
                    // No axis specifier provided. Assume child
                    if (null == (selectDesc = this.ParseNodeTest(QueryAxisType.Child)))
                    {
                        // No nodeTest either.. clearly not a Step
                        return(null);
                    }
                }
            }

            if (null == selectDesc)
            {
                this.ThrowError(QueryCompileError.InvalidLocationStep);
            }

            XPathExprList predicates = null;

            if (!abbreviatedStep)
            {
                // Abbreviated steps are not permitted predicates
                predicates = this.ParsePredicates();
            }

            return(new XPathStepExpr(selectDesc, predicates));
        }
        private XPathStepExpr ParseStep()
        {
            QueryAxisType      axisType = this.ParseAxisSpecifier();
            NodeSelectCriteria desc     = null;
            bool flag = false;

            if (axisType != QueryAxisType.None)
            {
                desc = this.ParseNodeTest(axisType);
            }
            else if (this.NextToken(XPathTokenID.Period) != null)
            {
                desc = new NodeSelectCriteria(QueryAxisType.Self, NodeQName.Empty, QueryNodeType.All);
                flag = true;
            }
            else if (this.NextToken(XPathTokenID.DblPeriod) != null)
            {
                desc = new NodeSelectCriteria(QueryAxisType.Parent, NodeQName.Empty, QueryNodeType.Ancestor);
                flag = true;
            }
            else
            {
                desc = this.ParseNodeTest(QueryAxisType.Child);
                if (desc == null)
                {
                    return(null);
                }
            }
            if (desc == null)
            {
                this.ThrowError(QueryCompileError.InvalidLocationStep);
            }
            XPathExprList predicates = null;

            if (!flag)
            {
                predicates = this.ParsePredicates();
            }
            return(new XPathStepExpr(desc, predicates));
        }
Пример #6
0
        // Is it possible to select nodes matching the given criteria from nodes of the given type
        internal static bool IsSelectPossible(QueryNodeType nodeType, NodeSelectCriteria desc)
        {
            if (0 != (nodeType & QueryNodeType.Attribute))
            {
                switch (desc.Axis.Type)
                {
                default:
                    return(false);

                // Navigation is possible from attributes on these axes
                case QueryAxisType.Self:
                case QueryAxisType.Ancestor:
                case QueryAxisType.AncestorOrSelf:
                case QueryAxisType.Parent:
                    return(true);
                }
            }
            else if (0 != (nodeType & QueryNodeType.Root))
            {
                if (AxisDirection.Reverse == desc.Axis.Direction)
                {
                    return(false);
                }

                switch (desc.Axis.Type)
                {
                default:
                    return(true);

                // Navigation is possible from attributes on these axes
                case QueryAxisType.Attribute:
                case QueryAxisType.Namespace:
                    return(false);
                }
            }

            return(true);
        }
Пример #7
0
 internal SelectOpcode(NodeSelectCriteria criteria)
     : this(OpcodeID.Select, criteria)
 {
 }
Пример #8
0
 internal XPathStepExpr(NodeSelectCriteria desc, XPathExprList predicates) : base(XPathExprType.PathStep, ValueDataType.Sequence, predicates)
 {
     this.selectDesc = desc;
 }
Пример #9
0
 internal XPathStepExpr(NodeSelectCriteria desc) : this(desc, null)
 {
 }
Пример #10
0
        XPathStepExpr ParseStep()
        {
            QueryAxisType axis = this.ParseAxisSpecifier();
            NodeSelectCriteria selectDesc = null;
            bool abbreviatedStep = false;

            if (QueryAxisType.None != axis)
            {
                // Valid axis specifier - must be followed by a nodeTest
                selectDesc = this.ParseNodeTest(axis);
            }
            else
            {
                // No axis specifier. This could be an abbreviated step - shortcuts for 'self' or 'parent'
                if (null != this.NextToken(XPathTokenID.Period))
                {
                    selectDesc = new NodeSelectCriteria(QueryAxisType.Self, NodeQName.Empty, QueryNodeType.All);
                    abbreviatedStep = true;
                }
                else if (null != this.NextToken(XPathTokenID.DblPeriod))
                {
                    // A shortcut for parent
                    selectDesc = new NodeSelectCriteria(QueryAxisType.Parent, NodeQName.Empty, QueryNodeType.Ancestor);
                    abbreviatedStep = true;
                }
                else
                {
                    // No axis specifier provided. Assume child
                    if (null == (selectDesc = this.ParseNodeTest(QueryAxisType.Child)))
                    {
                        // No nodeTest either.. clearly not a Step
                        return null;
                    }
                }
            }

            if (null == selectDesc)
            {
                this.ThrowError(QueryCompileError.InvalidLocationStep);
            }

            XPathExprList predicates = null;

            if (!abbreviatedStep)
            {
                // Abbreviated steps are not permitted predicates
                predicates = this.ParsePredicates();
            }

            return new XPathStepExpr(selectDesc, predicates);
        }
Пример #11
0
 internal SelectOpcode(NodeSelectCriteria criteria) : this(OpcodeID.Select, criteria)
 {
 }
Пример #12
0
 public bool Equals(NodeSelectCriteria criteria)
 {
     return (this.axis.Type == criteria.axis.Type && this.type == criteria.type && this.qname.Equals(criteria.qname));
 }
Пример #13
0
 internal SelectOpcode(OpcodeID id, NodeSelectCriteria criteria) : this(id, criteria, OpcodeFlags.None)
 {
 }
Пример #14
0
 internal SelectOpcode(OpcodeID id, NodeSelectCriteria criteria, OpcodeFlags flags)
     : base(id)
 {
     this.criteria = criteria;
     this.flags |= (flags | OpcodeFlags.Select);
     if (criteria.IsCompressable && (0 == (this.flags & OpcodeFlags.InitialSelect)))
     {
         this.flags |= OpcodeFlags.CompressableSelect;
     }
 }
Пример #15
0
 internal InitialSelectOpcode(NodeSelectCriteria criteria)
     : base(OpcodeID.InitialSelect, criteria, OpcodeFlags.InitialSelect)
 {
 }
 private XPathStepExpr ParseStep()
 {
     QueryAxisType axisType = this.ParseAxisSpecifier();
     NodeSelectCriteria desc = null;
     bool flag = false;
     if (axisType != QueryAxisType.None)
     {
         desc = this.ParseNodeTest(axisType);
     }
     else if (this.NextToken(XPathTokenID.Period) != null)
     {
         desc = new NodeSelectCriteria(QueryAxisType.Self, NodeQName.Empty, QueryNodeType.All);
         flag = true;
     }
     else if (this.NextToken(XPathTokenID.DblPeriod) != null)
     {
         desc = new NodeSelectCriteria(QueryAxisType.Parent, NodeQName.Empty, QueryNodeType.Ancestor);
         flag = true;
     }
     else
     {
         desc = this.ParseNodeTest(QueryAxisType.Child);
         if (desc == null)
         {
             return null;
         }
     }
     if (desc == null)
     {
         this.ThrowError(QueryCompileError.InvalidLocationStep);
     }
     XPathExprList predicates = null;
     if (!flag)
     {
         predicates = this.ParsePredicates();
     }
     return new XPathStepExpr(desc, predicates);
 }
Пример #17
0
 internal SelectOpcode(OpcodeID id, NodeSelectCriteria criteria)
     : this(id, criteria, OpcodeFlags.None)
 {
 }
Пример #18
0
 // Is it possible to select nodes matching the given criteria from nodes of the given type
 internal static bool IsSelectPossible(QueryNodeType nodeType, NodeSelectCriteria desc)
 {
     if (0 != (nodeType & QueryNodeType.Attribute))
     {
         switch(desc.Axis.Type)
         {
             default:
                 return false;
                 
                 // Navigation is possible from attributes on these axes
             case QueryAxisType.Self:
             case QueryAxisType.Ancestor:
             case QueryAxisType.AncestorOrSelf:
             case QueryAxisType.Parent:
                 return true;
         }
     }
     else if (0 != (nodeType & QueryNodeType.Root))
     {
         if (AxisDirection.Reverse == desc.Axis.Direction)
         {
             return false;
         }
         
         switch(desc.Axis.Type)
         {
             default:
                 return true;
                 
                 // Navigation is possible from attributes on these axes
             case QueryAxisType.Attribute:
             case QueryAxisType.Namespace:
                 return false;
         }                
     }
     
     return true;
 }    
 internal XPathStepExpr(NodeSelectCriteria desc, XPathExprList predicates) : base(XPathExprType.PathStep, ValueDataType.Sequence, predicates)
 {
     this.selectDesc = desc;
 }
Пример #20
0
 public bool Equals(NodeSelectCriteria criteria)
 {
     return(this.axis.Type == criteria.axis.Type && this.type == criteria.type && this.qname.Equals(criteria.qname));
 }
Пример #21
0
 internal InitialSelectOpcode(NodeSelectCriteria criteria)
     : base(OpcodeID.InitialSelect, criteria, OpcodeFlags.InitialSelect)
 {
 }
 internal XPathStepExpr(NodeSelectCriteria desc) : this(desc, null)
 {
 }