Пример #1
0
        private IQuery ProcessNode(AstNode root, IQuery qyInput)
        {
            IQuery result = null;

            if (root == null)
            {
                return(null);
            }

            switch (root.TypeOfAst)
            {
            case AstNode.QueryType.Axis:
                Axis axis = (Axis)root;
                result = ProcessAxis(axis, ProcessNode(axis.Input, qyInput));
                break;

            case AstNode.QueryType.Operator:
                result = ProcessOperator((Operator)root, null);
                break;

            case AstNode.QueryType.Filter:
                result = ProcessFilter((Filter)root);
                break;

            case AstNode.QueryType.ConstantOperand:
                result = ProcessOperand((Operand)root);
                break;

            case AstNode.QueryType.Function:
                result = ProcessFunction((Function)root, qyInput);
                break;

            case AstNode.QueryType.Root:
                result = new AbsoluteQuery();
                break;

            case AstNode.QueryType.Group:
                result = new GroupQuery(ProcessNode(((Group)root).GroupNode, qyInput));
                break;

            default:
                Debug.Assert(false, "Unknown QueryType encountered!!");
                break;
            }
            return(result);
        }
Пример #2
0
        private Query ProcessNode(AstNode root, Flags flags, out Props props)
        {
            if (++_parseDepth > MaxParseDepth)
            {
                throw XPathException.Create(SR.Xp_QueryTooComplex);
            }

            Debug.Assert(root != null, "root != null");
            Query result = null;
            props = Props.None;
            switch (root.Type)
            {
                case AstNode.AstType.Axis:
                    result = ProcessAxis((Axis)root, flags, out props);
                    break;
                case AstNode.AstType.Operator:
                    result = ProcessOperator((Operator)root, out props);
                    break;
                case AstNode.AstType.Filter:
                    result = ProcessFilter((Filter)root, flags, out props);
                    break;
                case AstNode.AstType.ConstantOperand:
                    result = new OperandQuery(((Operand)root).OperandValue);
                    break;
                case AstNode.AstType.Variable:
                    result = ProcessVariable((Variable)root);
                    break;
                case AstNode.AstType.Function:
                    result = ProcessFunction((Function)root, out props);
                    break;
                case AstNode.AstType.Group:
                    result = new GroupQuery(ProcessNode(((Group)root).GroupNode, Flags.None, out props));
                    break;
                case AstNode.AstType.Root:
                    result = new AbsoluteQuery();
                    break;
                default:
                    Debug.Fail("Unknown QueryType encountered!!");
                    break;
            }
            --_parseDepth;
            return result;
        }
 private AbsoluteQuery(AbsoluteQuery other) : base(other) {}
 private Query ProcessNode(AstNode root, Flags flags, out Props props) {
     Debug.Assert(root != null, "root != null");
     Query result = null;
     props = Props.None;
     switch (root.Type) {
     case AstNode.AstType.Axis:
         result = ProcessAxis((Axis)root, flags, out props);
         break;
     case AstNode.AstType.Operator:
         result = ProcessOperator((Operator)root, out props);
         break;
     case AstNode.AstType.Filter:
         result = ProcessFilter((Filter)root, flags, out props);
         break;
     case AstNode.AstType.ConstantOperand:
         result = new OperandQuery(((Operand)root).OperandValue);
         break;
     case AstNode.AstType.Variable:
         result = ProcessVariable((Variable)root);
         break;
     case AstNode.AstType.Function:
         result = ProcessFunction((Function)root, out props);
         break;
     case AstNode.AstType.Group:
         result = new GroupQuery(ProcessNode(((Group)root).GroupNode, Flags.None, out props));
         break;
     case AstNode.AstType.Root:
         result = new AbsoluteQuery();
         break;
     default:
         Debug.Assert(false, "Unknown QueryType encountered!!");
         break;
     }
     return result;
 }
Пример #5
0
        private IQuery ProcessNode(AstNode root, IQuery qyInput) {
            IQuery result = null;

            if (root == null)
                return null;

            switch (root.TypeOfAst) {

                case AstNode.QueryType.Axis:
                    Axis axis = (Axis)root;
                    result = ProcessAxis(axis, ProcessNode(axis.Input, qyInput));
                    break;

                case AstNode.QueryType.Operator:
                    result = ProcessOperator((Operator)root, null);
                    break;

                case AstNode.QueryType.Filter:
                    result = ProcessFilter((Filter)root);
                    break;

                case AstNode.QueryType.ConstantOperand:
                    result = ProcessOperand((Operand)root);
                    break;

                case AstNode.QueryType.Function:
                    result = ProcessFunction((Function)root, qyInput);
                    break;

                case AstNode.QueryType.Root:
                    result = new AbsoluteQuery();
                    break;

                case AstNode.QueryType.Group:
                    result = new GroupQuery(ProcessNode(((Group)root).GroupNode, qyInput));
                    break;
                default:
                    Debug.Assert(false, "Unknown QueryType encountered!!");
                    break;
            }
            return result;
        }