protected function parseAttrib($selector, $stream)
{
$attrib = $stream->next();
if ($stream->peek() == '|') {
$namespace = $attrib;
$stream->next();
$attrib = $stream->next();
} else {
$namespace = '*';
}
if ($stream->peek() == ']') {
return new Node\AttribNode($selector, $namespace, $attrib, 'exists', null);
}
$op = $stream->next();
if (!in_array($op, array('^=', '$=', '*=', '=', '~=', '|=', '!='))) {
throw new SyntaxError(sprintf("Operator expected, got '%s'", $op));
}
$value = $stream->next();
if (!$value->isType('Symbol') && !$value->isType('String')) {
throw new SyntaxError(sprintf("Expected string or symbol, got '%s'", $value));
}
return new Node\AttribNode($selector, $namespace, $attrib, $op, $value);
}