public void Visit(DothtmlAttributeNode attribute) { LastFoundNode = attribute; }
/// <summary> /// Reads the attribute. /// </summary> private DothtmlAttributeNode ReadAttribute() { var startIndex = CurrentIndex; var attribute = new DothtmlAttributeNode(); // attribute name DothtmlNameNode nameOrPrefix = ReadName(false, false, DothtmlTokenType.Text); if (Peek().Type == DothtmlTokenType.Colon) { attribute.PrefixSeparatorToken = Read(); attribute.AttributePrefixNode = nameOrPrefix; attribute.AttributeNameNode = ReadName(false, false, DothtmlTokenType.Text); } else { attribute.AttributeNameNode = nameOrPrefix; } //spaces before separator belong to name attribute.AttributeNameNode.WhitespacesAfter = SkipWhiteSpace(); if (Peek().Type == DothtmlTokenType.Equals) { attribute.ValueSeparatorToken = Read(); var valueStartTokens = SkipWhiteSpace(); var valueEndTokens = new AggregateList <DothtmlToken>(); // attribute value if (Peek().Type == DothtmlTokenType.SingleQuote || Peek().Type == DothtmlTokenType.DoubleQuote) { var quote = Peek().Type; Read(); valueStartTokens = valueStartTokens.AddLen(1); var startingWhitespaces = SkipWhiteSpace(); if (Peek().Type == DothtmlTokenType.OpenBinding) { attribute.ValueNode = ReadBindingValue(false, true); } else { attribute.ValueNode = ReadTextValue(false, true, DothtmlTokenType.Text); } //we had to jump forward to decide attribute.ValueNode.WhitespacesBefore = startingWhitespaces; Assert(quote); valueEndTokens.Add(PeekPart()); Read(); } else { attribute.ValueNode = ReadTextValue(false, false, DothtmlTokenType.Text); //these are not part of any attribute or value SkipWhiteSpace(); } attribute.ValueStartTokens = valueStartTokens; valueEndTokens.Add(SkipWhiteSpace()); attribute.ValueEndTokens = valueEndTokens; } attribute.Tokens.Add(GetTokensFrom(startIndex)); return(attribute); }
public void Visit(DothtmlAttributeNode attribute) { LastFoundNode = attribute; }