function parse_doctype()
{
$start = $this->pos;
if ($this->next_search('[>', false) === self::TOK_UNKNOWN) {
if ($this->doc[$this->pos] === '[') {
if ($this->next_pos(']', false) !== self::TOK_UNKNOWN || $this->next_pos('>', false) !== self::TOK_UNKNOWN) {
$this->addError('Invalid doctype');
return false;
}
}
$this->token_start = $start;
$this->status['dtd'] = $this->getTokenString(2, -1);
$this->status['last_pos'] = $this->pos;
return true;
} else {
$this->addError('Invalid doctype');
return false;
}
}