/** * With the start token expected to be the first token of a selector group, create and issue the * group, then invoke handleDeclarationBlock. At exit the last token returned from the iterator is * expected to be '}'. */ private void handleRuleSet( CssToken start, final CssTokenIterator iter, final CssContentHandler doc, CssErrorHandler err) throws CssException { char errChar = '{'; try { List<CssSelector> selectors = handleSelectors(start, iter, err); errChar = '}'; if (selectors == null) { // handleSelectors() has issued errors, we forward iter.next(MATCH_CLOSEBRACE); return; } if (debug) { checkState(iter.last.getChar() == '{'); checkState(!selectors.isEmpty()); } doc.selectors(selectors); handleDeclarationBlock(iter.next(), iter, doc, err); doc.endSelectors(selectors); } catch (NoSuchElementException nse) { err.error( new CssGrammarException(GRAMMAR_PREMATURE_EOF, iter.last.location, "'" + errChar + "'")); throw new PrematureEOFException(); } if (debug) { checkState(iter.last.getChar() == '}'); } }