public static XmlDocumentSyntax XmlDocument(
     XmlDeclarationSyntax prologue,
     SyntaxList<SyntaxNode> precedingMisc,
     XmlNodeSyntax body,
     SyntaxList<XmlNodeSyntax> followingMisc,
     SyntaxToken eof)
 {
     return new XmlDocumentSyntax(SyntaxKind.XmlDocument, prologue, precedingMisc.Node, body, followingMisc.Node, eof);
 }
 public XmlDocumentSyntax(
     SyntaxKind kind,
     XmlDeclarationSyntax prologue,
     SyntaxNode precedingMisc,
     XmlNodeSyntax body,
     SyntaxNode followingMisc,
     SyntaxToken eof) : base(kind)
 {
     this.Prologue = prologue;
     this.PrecedingMisc = precedingMisc;
     this.Body = body;
     this.FollowingMisc = followingMisc;
     this.Eof = eof;
     SlotCount = 5;
 }
 public virtual SyntaxNode VisitXmlNode(XmlNodeSyntax node)
 {
     return VisitSyntaxNode(node);
 }
Beispiel #4
0
        protected void VisitRanges(XmlNodeSyntax root, StringBuilder sb)
        {
            var ranges = new List<ClassifiedRange>();

            ClassifierVisitor.Visit(
                root,
                0,
                sourceText.Length,
                (start, length, node, classification) =>
                {
                    var line = TextUtilities.GetLineFromPosition(start, sourceText);
                    var lineText = sourceText.Substring(line.Item1, line.Item2);

                    ranges.Add(
                        new ClassifiedRange
                        {
                            Classification = classification,
                            Node = node,
                            Text = sourceText.Substring(start, length),
                            LineText = lineText,
                            LineStart = line.Item1,
                            LineNumber = TextUtilities.GetLineNumber(start, lineLengths),
                            Start = start,
                            Length = length
                        });
                });

            ranges = RangeUtilities.FillGaps(
                sourceText,
                ranges,
                r => r.Start,
                r => r.Length,
                (s, l, t) => new ClassifiedRange
                {
                    Start = s,
                    Length = l,
                    Text = t.Substring(s, l)
                }).ToList();

            foreach (var range in ranges)
            {
                GenerateRange(range, sb);
            }
        }
 public void Add(XmlNodeSyntax xml)
 {
     _content.Add(xml);
 }
 public static XmlNodeSyntax XmlAttribute(XmlNameSyntax name, PunctuationSyntax equals, XmlNodeSyntax value)
 {
     return new XmlAttributeSyntax(name, equals, value);
 }