protected function Tokenizer::cdataSection in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/masterminds/html5/src/HTML5/Parser/Tokenizer.php \Masterminds\HTML5\Parser\Tokenizer::cdataSection()
Handle a CDATA section.
1 call to Tokenizer::cdataSection()
- Tokenizer::markupDeclaration in vendor/
masterminds/ html5/ src/ HTML5/ Parser/ Tokenizer.php - Look for markup.
File
- vendor/
masterminds/ html5/ src/ HTML5/ Parser/ Tokenizer.php, line 806
Class
- Tokenizer
- The HTML5 tokenizer.
Namespace
Masterminds\HTML5\ParserCode
protected function cdataSection() {
if ($this->scanner
->current() != '[') {
return false;
}
$cdata = '';
$this->scanner
->next();
$chars = $this->scanner
->charsWhile('CDAT');
if ($chars != 'CDATA' || $this->scanner
->current() != '[') {
$this
->parseError('Expected [CDATA[, got %s', $chars);
return $this
->bogusComment('<![' . $chars);
}
$tok = $this->scanner
->next();
do {
if ($tok === false) {
$this
->parseError('Unexpected EOF inside CDATA.');
$this
->bogusComment('<![CDATA[' . $cdata);
return true;
}
$cdata .= $tok;
$tok = $this->scanner
->next();
} while (!$this
->sequenceMatches(']]>'));
// Consume ]]>
$this->scanner
->consume(3);
$this->events
->cdata($cdata);
return true;
}