Пример #1
0
 public QilNode XPathNamespace(QilNode expr)
 {
     return(f.XPathNamespace(expr));
 }
 /// <summary>
 /// Called when all replacements have already been made and all annotations are complete.
 /// </summary>
 protected virtual QilNode NoReplace(QilNode node)
 {
     return(node);
 }
        //-----------------------------------------------
        // QilScopedVisitor overrides
        //-----------------------------------------------

        /// <summary>
        /// Annotate this iterator or function with a generated name.
        /// </summary>
        protected override void BeginScope(QilNode node)
        {
            this.ngen.NameOf(node);
        }
 protected override QilNode VisitUnknown(QilNode n)
 {
     return(NoReplace(n));
 }
 protected override QilNode VisitXmlContext(QilNode n)
 {
     return(NoReplace(n));
 }
        //-----------------------------------------------
        // Constructor
        //-----------------------------------------------

        /// <summary>
        /// Construct a new node
        /// </summary>
        public QilTernary(QilNodeType nodeType, QilNode left, QilNode center, QilNode right) : base(nodeType)
        {
            _left   = left;
            _center = center;
            _right  = right;
        }
Пример #7
0
 public static void Validate(QilNode node)
 {
     Debug.Assert(node != null);
     new QilValidationVisitor().VisitAssumeReference(node);
 }
Пример #8
0
        /// <summary>
        /// If a cloned reference is in scope, replace "oldNode".  Otherwise, return "oldNode".
        /// </summary>
        protected override QilNode VisitReference(QilNode oldNode)
        {
            QilNode newNode = FindClonedReference(oldNode);

            return(base.VisitReference(newNode == null ? oldNode : newNode));
        }
Пример #9
0
        //-----------------------------------------------
        // QilScopedVisitor methods
        //-----------------------------------------------

        /// <summary>
        /// Push node and its shallow clone onto the substitution list.
        /// </summary>
        protected override void BeginScope(QilNode node)
        {
            _subs.AddSubstitutionPair(node, node.ShallowClone(_fac));
        }
Пример #10
0
 public QilNode XsltCopyOf(QilNode expr)
 {
     return(f.XsltCopyOf(expr));
 }
Пример #11
0
 public QilNode XsltConvert(QilNode expr, XmlQueryType t)
 {
     return(f.XsltConvert(expr, t));
 }
Пример #12
0
 public QilNode XsltCopy(QilNode expr, QilNode content)
 {
     return(f.XsltCopy(expr, content));
 }
Пример #13
0
 //-----------------------------------------------
 // XSLT
 //-----------------------------------------------
 public QilNode XsltGenerateId(QilNode expr)
 {
     return(f.XsltGenerateId(expr));
 }
Пример #14
0
 public QilNode XPathPreceding(QilNode expr)
 {
     return(f.XPathPreceding(expr));
 }
Пример #15
0
        //-----------------------------------------------
        // Constructor
        //-----------------------------------------------

        /// <summary>
        /// Construct a new node
        /// </summary>
        public QilDataSource(QilNodeType nodeType, QilNode name, QilNode baseUri) : base(nodeType, name, baseUri)
        {
        }
Пример #16
0
 /// <summary>
 /// Pop entry from substitution list.
 /// </summary>
 protected override void EndScope(QilNode node)
 {
     _subs.RemoveLastSubstitutionPair();
 }
        //-----------------------------------------------
        // Constructor
        //-----------------------------------------------

        /// <summary>
        /// Construct a new node
        /// </summary>
        public QilTargetType(QilNodeType nodeType, QilNode expr, QilNode targetType) : base(nodeType, expr, targetType)
        {
        }
Пример #18
0
        //-----------------------------------------------
        // QilCloneVisitor methods
        //-----------------------------------------------

        /// <summary>
        /// Find the clone of an in-scope reference.
        /// </summary>
        protected QilNode FindClonedReference(QilNode node)
        {
            return(_subs.FindReplacement(node));
        }
Пример #19
0
 /// <summary>
 /// Pop scope.
 /// </summary>
 protected override void EndScope(QilNode node)
 {
     this.scope.Remove(node);
 }
Пример #20
0
        //-----------------------------------------------
        // Entry
        //-----------------------------------------------

        public QilNode Clone(QilNode node)
        {
            QilDepthChecker.Check(node);
            // Assume that iterator nodes at the top-level are references rather than definitions
            return(VisitAssumeReference(node));
        }
Пример #21
0
        //-----------------------------------------------
        // QilVisitor overrides
        //-----------------------------------------------

        protected override QilNode VisitChildren(QilNode parent)
        {
            if (this.parents.Contains(parent))
            {
                // We have already visited the node that starts the infinite loop, but don't visit its children
                SetError(parent, "Infinite loop");
            }
            else if (AddNode(parent))
            {
                if (parent.XmlType == null)
                {
                    SetError(parent, "Type information missing");
                }
                else
                {
                    XmlQueryType type = this.typeCheck.Check(parent);

                    // BUGBUG: Hack to account for Xslt compiler type fixups
                    if (!type.IsSubtypeOf(parent.XmlType))
                    {
                        SetError(parent, "Type information was not correctly inferred");
                    }
                }

                this.parents.Add(parent, parent);

                for (int i = 0; i < parent.Count; i++)
                {
                    if (parent[i] == null)
                    {
                        // Allow parameter name and default value to be null
                        if (parent.NodeType == QilNodeType.Parameter)
                        {
                            continue;
                        }
                        // Do not allow null anywhere else in the graph
                        else
                        {
                            SetError(parent, "Child " + i + " must not be null");
                        }
                    }

                    if (parent.NodeType == QilNodeType.GlobalVariableList ||
                        parent.NodeType == QilNodeType.GlobalParameterList ||
                        parent.NodeType == QilNodeType.FunctionList)
                    {
                        if (((QilReference)parent[i]).DebugName == null)
                        {
                            SetError(parent[i], "DebugName must not be null");
                        }
                    }

                    // If child is a reference, then call VisitReference instead of Visit in order to avoid circular visits.
                    if (IsReference(parent, i))
                    {
                        VisitReference(parent[i]);
                    }
                    else
                    {
                        Visit(parent[i]);
                    }
                }

                this.parents.Remove(parent);
            }

            return(parent);
        }
Пример #22
0
 public QilSortKey(QilNodeType nodeType, QilNode key, QilNode collation) : base(nodeType, key, collation)
 {
 }
 protected override QilNode VisitFalse(QilNode n)
 {
     return(NoReplace(n));
 }
Пример #24
0
 public void AddSubstitutionPair(QilNode find, QilNode replace)
 {
     _s.Add(find);
     _s.Add(replace);
 }
 /// <summary>
 /// Called when a pattern has matched and after replacement code is executed.
 /// </summary>
 protected virtual QilNode Replace(int pattern, QilNode original, QilNode replacement)
 {
     replacement.SourceLine = original.SourceLine;
     return(replacement);
 }
Пример #26
0
 public QilStrConcat(QilNodeType nodeType, QilNode delimiter, QilNode values) : base(nodeType, delimiter, values)
 {
 }
 /// <summary>
 /// Called in order to write out the xml type of a node.
 /// </summary>
 protected virtual void WriteXmlType(QilNode node)
 {
     this.writer.WriteAttributeString("xmlType", node.XmlType.ToString((this.options & Options.RoundTripTypeInfo) != 0 ? "S" : "G"));
 }
Пример #28
0
        //-----------------------------------------------
        // Constructor
        //-----------------------------------------------

        /// <summary>
        /// Construct an iterator
        /// </summary>
        public QilIterator(QilNodeType nodeType, QilNode binding) : base(nodeType)
        {
            Binding = binding;
        }
 /// <summary>
 /// Clear the name annotation on this iterator or function.
 /// </summary>
 protected override void EndScope(QilNode node)
 {
     this.ngen.ClearName(node);
 }
Пример #30
0
 public QilNode XPathFollowing(QilNode expr)
 {
     return(f.XPathFollowing(expr));
 }