Exemplo n.º 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;
        }
Exemplo n.º 7
0
 public static void Validate(QilNode node)
 {
     Debug.Assert(node != null);
     new QilValidationVisitor().VisitAssumeReference(node);
 }
Exemplo n.º 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));
        }
Exemplo n.º 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));
        }
Exemplo n.º 10
0
 public QilNode XsltCopyOf(QilNode expr)
 {
     return(f.XsltCopyOf(expr));
 }
Exemplo n.º 11
0
 public QilNode XsltConvert(QilNode expr, XmlQueryType t)
 {
     return(f.XsltConvert(expr, t));
 }
Exemplo n.º 12
0
 public QilNode XsltCopy(QilNode expr, QilNode content)
 {
     return(f.XsltCopy(expr, content));
 }
Exemplo n.º 13
0
 //-----------------------------------------------
 // XSLT
 //-----------------------------------------------
 public QilNode XsltGenerateId(QilNode expr)
 {
     return(f.XsltGenerateId(expr));
 }
Exemplo n.º 14
0
 public QilNode XPathPreceding(QilNode expr)
 {
     return(f.XPathPreceding(expr));
 }
Exemplo n.º 15
0
        //-----------------------------------------------
        // Constructor
        //-----------------------------------------------

        /// <summary>
        /// Construct a new node
        /// </summary>
        public QilDataSource(QilNodeType nodeType, QilNode name, QilNode baseUri) : base(nodeType, name, baseUri)
        {
        }
Exemplo n.º 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)
        {
        }
Exemplo n.º 18
0
        //-----------------------------------------------
        // QilCloneVisitor methods
        //-----------------------------------------------

        /// <summary>
        /// Find the clone of an in-scope reference.
        /// </summary>
        protected QilNode FindClonedReference(QilNode node)
        {
            return(_subs.FindReplacement(node));
        }
Exemplo n.º 19
0
 /// <summary>
 /// Pop scope.
 /// </summary>
 protected override void EndScope(QilNode node)
 {
     this.scope.Remove(node);
 }
Exemplo n.º 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));
        }
Exemplo n.º 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);
        }
Exemplo n.º 22
0
 public QilSortKey(QilNodeType nodeType, QilNode key, QilNode collation) : base(nodeType, key, collation)
 {
 }
 protected override QilNode VisitFalse(QilNode n)
 {
     return(NoReplace(n));
 }
Exemplo 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);
 }
Exemplo n.º 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"));
 }
Exemplo n.º 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);
 }
Exemplo n.º 30
0
 public QilNode XPathFollowing(QilNode expr)
 {
     return(f.XPathFollowing(expr));
 }