function Tokenizer::isCommentEnd
Check if the scanner has reached the end of a comment.
Return value
bool
1 call to Tokenizer::isCommentEnd()
- Tokenizer::comment in vendor/
masterminds/ html5/ src/ HTML5/ Parser/ Tokenizer.php - Read a comment. Expects the first tok to be inside of the comment.
File
-
vendor/
masterminds/ html5/ src/ HTML5/ Parser/ Tokenizer.php, line 706
Class
- Tokenizer
- The HTML5 tokenizer.
Namespace
Masterminds\HTML5\ParserCode
protected function isCommentEnd() {
$tok = $this->scanner
->current();
// EOF
if (false === $tok) {
// Hit the end.
$this->parseError('Unexpected EOF in a comment.');
return true;
}
// If next two tokens are not '--', not the end.
if ('-' != $tok || '-' != $this->scanner
->peek()) {
return false;
}
$this->scanner
->consume(2);
// Consume '-' and one of '!' or '>'
// Test for '>'
if ('>' == $this->scanner
->current()) {
return true;
}
// Test for '!>'
if ('!' == $this->scanner
->current() && '>' == $this->scanner
->peek()) {
$this->scanner
->consume();
// Consume the last '>'
return true;
}
// Unread '-' and one of '!' or '>';
$this->scanner
->unconsume(2);
return false;
}