예제 #1
0
 internal Green(XmlNameSyntax.Green nameNode, SyntaxToken.Green equalsSyntax, XmlNodeSyntax.Green valueNode)
     : base(SyntaxKind.XmlAttribute)
 {
     this.SlotCount = 3;
     this.nameNode  = nameNode;
     AdjustWidth(nameNode);
     this.equalsSyntax = equalsSyntax;
     AdjustWidth(equalsSyntax);
     this.valueNode = valueNode;
     AdjustWidth(valueNode);
 }
예제 #2
0
 internal Green(XmlNameSyntax.Green nameNode, SyntaxToken.Green equalsSyntax, XmlNodeSyntax.Green valueNode, DiagnosticInfo[] diagnostics, SyntaxAnnotation[] annotations)
     : base(SyntaxKind.XmlAttribute, diagnostics, annotations)
 {
     this.SlotCount = 3;
     this.nameNode  = nameNode;
     AdjustWidth(nameNode);
     this.equalsSyntax = equalsSyntax;
     AdjustWidth(equalsSyntax);
     this.valueNode = valueNode;
     AdjustWidth(valueNode);
 }
예제 #3
0
 internal Green(SyntaxToken.Green lessThanToken, XmlNameSyntax.Green name, SyntaxToken.Green slashGreaterThanToken)
     : base(SyntaxKind.XmlElementEndTag)
 {
     this.SlotCount     = 3;
     this.lessThanToken = lessThanToken;
     AdjustWidth(lessThanToken);
     this.name = name;
     AdjustWidth(name);
     this.slashGreaterThanToken = slashGreaterThanToken;
     AdjustWidth(slashGreaterThanToken);
 }
예제 #4
0
 internal Green(SyntaxToken.Green lessThanToken, XmlNameSyntax.Green name, SyntaxToken.Green slashGreaterThanToken, DiagnosticInfo[] diagnostics, SyntaxAnnotation[] annotations)
     : base(SyntaxKind.XmlElementEndTag, diagnostics, annotations)
 {
     this.SlotCount     = 3;
     this.lessThanToken = lessThanToken;
     AdjustWidth(lessThanToken);
     this.name = name;
     AdjustWidth(name);
     this.slashGreaterThanToken = slashGreaterThanToken;
     AdjustWidth(slashGreaterThanToken);
 }
예제 #5
0
 internal Green(PunctuationSyntax.Green lessThanToken, XmlNameSyntax.Green name, GreenNode attributes, PunctuationSyntax.Green slashGreaterThanToken)
     : base(SyntaxKind.XmlEmptyElement)
 {
     this.SlotCount     = 4;
     this.lessThanToken = lessThanToken;
     AdjustWidth(lessThanToken);
     this.name = name;
     AdjustWidth(name);
     this.attributes = attributes;
     AdjustWidth(attributes);
     this.slashGreaterThanToken = slashGreaterThanToken;
     AdjustWidth(slashGreaterThanToken);
 }
예제 #6
0
 internal Green(PunctuationSyntax.Green lessThanToken, XmlNameSyntax.Green name, GreenNode attributes, PunctuationSyntax.Green slashGreaterThanToken, DiagnosticInfo[] diagnostics, SyntaxAnnotation[] annotations)
     : base(SyntaxKind.XmlEmptyElement, diagnostics, annotations)
 {
     this.SlotCount     = 4;
     this.lessThanToken = lessThanToken;
     AdjustWidth(lessThanToken);
     this.name = name;
     AdjustWidth(name);
     this.attributes = attributes;
     AdjustWidth(attributes);
     this.slashGreaterThanToken = slashGreaterThanToken;
     AdjustWidth(slashGreaterThanToken);
 }
예제 #7
0
        internal static int MatchEndElement(this List <XmlContext> @this, XmlNameSyntax.Green name)
        {
            Debug.Assert(name == null || name.Kind == SyntaxKind.XmlName);
            var last = @this.Count - 1;

            if (name == null)
            {
                return(last);
            }

            var i = last;

            while (i >= 0)
            {
                var context  = @this[i];
                var nameExpr = context.StartElement.NameNode;
                if (nameExpr.Kind == SyntaxKind.XmlName)
                {
                    var startName = ((XmlNameSyntax.Green)nameExpr);
                    if (startName.LocalName.Text == name.LocalName.Text)
                    {
                        var startPrefix = startName.Prefix;
                        var endPrefix   = name.Prefix;
                        if (startPrefix == endPrefix)
                        {
                            break;
                        }

                        if (startPrefix != null && endPrefix != null)
                        {
                            if (startPrefix.Name.Text == endPrefix.Name.Text)
                            {
                                break;
                            }
                        }
                    }
                }

                i -= 1;
            }

            return(i);
        }