private function parseRuleSet($oRuleSet)
{
while ($this->comes(';')) {
$this->consume(';');
$this->consumeWhiteSpace();
}
while (!$this->comes('}')) {
$oRule = null;
if ($this->oParserSettings->bLenientParsing) {
try {
$oRule = $this->parseRule();
} catch (UnexpectedTokenException $e) {
try {
$sConsume = $this->consumeUntil(array("\n", ";", '}'), true);
// We need to “unfind” the matches to the end of the ruleSet as this will be matched later
if ($this->streql(substr($sConsume, -1), '}')) {
--$this->iCurrentPosition;
} else {
$this->consumeWhiteSpace();
while ($this->comes(';')) {
$this->consume(';');
}
}
} catch (UnexpectedTokenException $e) {
// We’ve reached the end of the document. Just close the RuleSet.
return;
}
}
} else {
$oRule = $this->parseRule();
}
if ($oRule) {
$oRuleSet->addRule($oRule);
}
$this->consumeWhiteSpace();
}
$this->consume('}');
}