public override SyntaxNode VisitXmlString(XmlStringSyntax node)
        {
            bool anyChanges         = false;
            var  newStartQuoteToken = ((PunctuationSyntax)Visit(node.StartQuoteToken));

            if (node.StartQuoteToken != newStartQuoteToken)
            {
                anyChanges = true;
            }

            var newTextTokens = VisitList(node.TextTokens);

            if (node.TextTokens != newTextTokens.Node)
            {
                anyChanges = true;
            }

            var newEndQuoteToken = ((PunctuationSyntax)Visit(node.EndQuoteToken));

            if (node.EndQuoteToken != newEndQuoteToken)
            {
                anyChanges = true;
            }

            if (anyChanges)
            {
                return(new XmlStringSyntax(node.Kind, newStartQuoteToken, newTextTokens.Node, newEndQuoteToken));
            }
            else
            {
                return(node);
            }
        }
 public XmlDeclarationOptionSyntax(SyntaxKind kind, XmlNameTokenSyntax name, PunctuationSyntax equals, XmlStringSyntax value)
     : base(kind)
 {
     this.Name = name;
     this.Equals = equals;
     this.Value = value;
     this.SlotCount = 3;
 }
示例#3
0
        /*  <summary>
         * ''' Represents a string of XML characters embedded as the content of an XML
         * ''' element.
         * ''' </summary>
         */
        public static XmlStringSyntax XmlString(PunctuationSyntax startQuoteToken, SyntaxList <XmlTextTokenSyntax> textTokens, PunctuationSyntax endQuoteToken)
        {
            //Debug.Assert(startQuoteToken != null && SyntaxFacts.IsXmlStringStartQuoteToken(startQuoteToken.Kind));
            //Debug.Assert(endQuoteToken != null && SyntaxFacts.IsXmlStringEndQuoteToken(endQuoteToken.Kind));

            var result = new XmlStringSyntax(SyntaxKind.XmlString, startQuoteToken, textTokens, endQuoteToken);

            return(result);
        }
示例#4
0
 public XmlAttributeSyntax WithValue(XmlStringSyntax value)
 {
     return(this.Update(this.NameNode, this.Equals, value));
 }
示例#5
0
        public XmlAttributeSyntax Update(XmlNameSyntax name, PunctuationSyntax equalsToken, XmlStringSyntax value)
        {
            if (name != this.NameNode || equalsToken != this.Equals || value != this.ValueNode)
            {
                var newNode     = SyntaxFactory.XmlAttribute(name, equalsToken, value);
                var annotations = this.GetAnnotations();
                if (annotations != null && annotations.Length > 0)
                {
                    return(newNode.WithAnnotations(annotations));
                }
                return(newNode);
            }

            return(this);
        }
示例#6
0
 public XmlDeclarationOptionSyntax(SyntaxKind kind, XmlNameTokenSyntax name, PunctuationSyntax equals, XmlStringSyntax value)
     : base(kind)
 {
     this.Name      = name;
     this.Equals    = equals;
     this.Value     = value;
     this.SlotCount = 3;
 }
示例#7
0
        /*  <summary>
         * ''' Represents an XML document prologue option - version, encoding, standalone or
         * ''' whitespace in an XML literal expression.
         * ''' </summary>
         */
        public static XmlDeclarationOptionSyntax XmlDeclarationOption(XmlNameTokenSyntax name, PunctuationSyntax equals, XmlStringSyntax value)
        {
            Debug.Assert(name != null && name.Kind == SyntaxKind.XmlNameToken);
            Debug.Assert(equals != null && equals.Kind == SyntaxKind.EqualsToken);
            Debug.Assert(value != null);

            return((XmlDeclarationOptionSyntax) new XmlDeclarationOptionSyntax.Green(name?.GreenNode, equals?.GreenNode, value?.GreenNode).CreateRed());
        }
示例#8
0
 public virtual SyntaxNode VisitXmlString(XmlStringSyntax node)
 {
     return(VisitXmlNode(node));
 }
示例#9
0
        /*  <summary>
         * ''' Represents an XML document prologue option - version, encoding, standalone or
         * ''' whitespace in an XML literal expression.
         * ''' </summary>
         */
        public static XmlDeclarationOptionSyntax XmlDeclarationOption(XmlNameTokenSyntax name, PunctuationSyntax equals, XmlStringSyntax value)
        {
            Debug.Assert(name != null && name.Kind == SyntaxKind.XmlNameToken);
            Debug.Assert(equals != null && equals.Kind == SyntaxKind.EqualsToken);
            Debug.Assert(value != null);
            //int hash;
            //var cached = SyntaxNodeCache.TryGetNode(SyntaxKind.XmlDeclarationOption, _factoryContext, name, equals, value, hash);
            //if (cached != null)
            //{
            //    return ((XmlDeclarationOptionSyntax)cached);
            //}

            var result = new XmlDeclarationOptionSyntax(SyntaxKind.XmlDeclarationOption, name, equals, value);

            //if (hash >= 0)
            //{
            //    SyntaxNodeCache.AddNode(result, hash);
            //}

            return(result);
        }
 public virtual SyntaxNode VisitXmlString(XmlStringSyntax node)
 {
     return VisitXmlNode(node);
 }
        /*  <summary>
        ''' Represents an XML document prologue option - version, encoding, standalone or
        ''' whitespace in an XML literal expression.
        ''' </summary>
        */
        internal static XmlDeclarationOptionSyntax XmlDeclarationOption(XmlNameTokenSyntax name, PunctuationSyntax equals, XmlStringSyntax value)
        {
            Debug.Assert(name != null && name.Kind == SyntaxKind.XmlNameToken);
            Debug.Assert(equals != null && equals.Kind == SyntaxKind.EqualsToken);
            Debug.Assert(value != null);
            //int hash;
            //var cached = SyntaxNodeCache.TryGetNode(SyntaxKind.XmlDeclarationOption, _factoryContext, name, equals, value, hash);
            //if (cached != null)
            //{
            //    return ((XmlDeclarationOptionSyntax)cached);
            //}

            var result = new XmlDeclarationOptionSyntax(SyntaxKind.XmlDeclarationOption, name, equals, value);
            //if (hash >= 0)
            //{
            //    SyntaxNodeCache.AddNode(result, hash);
            //}

            return result;
        }
        /*  <summary>
        ''' Represents a string of XML characters embedded as the content of an XML
        ''' element.
        ''' </summary>
        */
        internal static XmlStringSyntax XmlString(PunctuationSyntax startQuoteToken, SyntaxList<XmlTextTokenSyntax> textTokens, PunctuationSyntax endQuoteToken)
        {
            //Debug.Assert(startQuoteToken != null && SyntaxFacts.IsXmlStringStartQuoteToken(startQuoteToken.Kind));
            //Debug.Assert(endQuoteToken != null && SyntaxFacts.IsXmlStringEndQuoteToken(endQuoteToken.Kind));

            var result = new XmlStringSyntax(SyntaxKind.XmlString, startQuoteToken, textTokens, endQuoteToken);

            return result;
        }