private void ReadPseudoClassOrPseudoElement() { StringBuilder valueBuilder = new StringBuilder(); // Read the opening colon. valueBuilder.Append((char)Reader.Read()); while (!Reader.EndOfStream) { char nextChar = (char)Reader.Peek(); if (char.IsWhiteSpace(nextChar) || reservedChars.Contains(nextChar)) { break; } valueBuilder.Append((char)Reader.Read()); } if (valueBuilder.Length > 0) { string value = valueBuilder.ToString(); StyleSheetLexerTokenType type = value.StartsWith("::") ? StyleSheetLexerTokenType.PseudoElement : StyleSheetLexerTokenType.PseudoClass; tokens.Enqueue(new StyleSheetLexerToken(type, value)); } }
public StyleSheetLexerToken(StyleSheetLexerTokenType type, string value) { this.Type = type; this.Value = value; }