You are here

protected function Tokenizer::isCommentEnd in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/masterminds/html5/src/HTML5/Parser/Tokenizer.php \Masterminds\HTML5\Parser\Tokenizer::isCommentEnd()

Check if the scanner has reached the end of a comment.

1 call to Tokenizer::isCommentEnd()
Tokenizer::comment in vendor/masterminds/html5/src/HTML5/Parser/Tokenizer.php
Read a comment.

File

vendor/masterminds/html5/src/HTML5/Parser/Tokenizer.php, line 639

Class

Tokenizer
The HTML5 tokenizer.

Namespace

Masterminds\HTML5\Parser

Code

protected function isCommentEnd() {

  // EOF
  if ($this->scanner
    ->current() === false) {

    // Hit the end.
    $this
      ->parseError("Unexpected EOF in a comment.");
    return true;
  }

  // If it doesn't start with -, not the end.
  if ($this->scanner
    ->current() != '-') {
    return false;
  }

  // Advance one, and test for '->'
  if ($this->scanner
    ->next() == '-' && $this->scanner
    ->peek() == '>') {
    $this->scanner
      ->next();

    // Consume the last '>'
    return true;
  }

  // Unread '-';
  $this->scanner
    ->unconsume(1);
  return false;
}