protected function parse()
{
$p =& $this->parser;
$p->setPos(0);
$this->result = array();
if (!$this->parse_single()) {
return false;
}
while (count($this->result) > 0) {
switch ($p->token) {
case CSSQueryTokenizer::TOK_CHILD:
$this->parser->next_no_whitespace();
if (!$this->parse_result(false, 1)) {
return false;
}
break;
case CSSQueryTokenizer::TOK_SIBLING:
$this->parser->next_no_whitespace();
if (!$this->parse_result(true, 1)) {
return false;
}
break;
case CSSQueryTokenizer::TOK_PLUS:
$this->parser->next_no_whitespace();
if (!$this->parse_adjacent()) {
return false;
}
break;
case CSSQueryTokenizer::TOK_ALL:
case CSSQueryTokenizer::TOK_IDENTIFIER:
case CSSQueryTokenizer::TOK_STRING:
case CSSQueryTokenizer::TOK_BRACE_OPEN:
case CSSQueryTokenizer::TOK_BRACKET_OPEN:
case CSSQueryTokenizer::TOK_ID:
case CSSQueryTokenizer::TOK_CLASS:
case CSSQueryTokenizer::TOK_COLON:
if (!$this->parse_result()) {
return false;
}
break;
case CSSQueryTokenizer::TOK_NULL:
break 2;
default:
$this->error('Invalid search pattern(3): No result modifier found!');
return false;
}
}
return true;
}