private void SimpleSelectorSequence() { //simple_selector_sequence // : [ type_selector | universal ] // [ HASH | class | attrib | pseudo | negation ]* // | [ HASH | class | attrib | pseudo | negation ]+ // ; var named = false; for (var modifiers = 0; ; modifiers++) { var token = TryRead(ToTokenSpec(TokenKind.Hash), ToTokenSpec(Token.Dot()), ToTokenSpec(Token.LeftBracket()), ToTokenSpec(Token.Colon())); if (token == null) { if (named || modifiers > 0) { break; } TypeSelectorOrUniversal(); named = true; } else { if (modifiers == 0 && !named) { _generator.Universal(NamespacePrefix.None); // implied } if (token.Value.Kind == TokenKind.Hash) { _generator.Id(token.Value.Text); } else { Unread(token.Value); switch (token.Value.Text[0]) { case '.': Class(); break; case '[': Attrib(); break; case ':': Pseudo(); break; default: throw new Exception("Internal error."); } } } } }