You are here

protected function Tokenizer::isTagEnd 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::isTagEnd()

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

1 call to Tokenizer::isTagEnd()
Tokenizer::tagName in vendor/masterminds/html5/src/HTML5/Parser/Tokenizer.php
Consume a tag name and body. 8.2.4.10

File

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

Class

Tokenizer
The HTML5 tokenizer.

Namespace

Masterminds\HTML5\Parser

Code

protected function isTagEnd(&$selfClose) {
  $tok = $this->scanner
    ->current();
  if ($tok == '/') {
    $this->scanner
      ->next();
    $this->scanner
      ->whitespace();
    if ($this->scanner
      ->current() == '>') {
      $selfClose = true;
      return true;
    }
    if ($this->scanner
      ->current() === false) {
      $this
        ->parseError("Unexpected EOF inside of tag.");
      return true;
    }

    // Basically, we skip the / token and go on.
    // See 8.2.4.43.
    $this
      ->parseError("Unexpected '%s' inside of a tag.", $this->scanner
      ->current());
    return false;
  }
  if ($this->scanner
    ->current() == '>') {
    return true;
  }
  if ($this->scanner
    ->current() === false) {
    $this
      ->parseError("Unexpected EOF inside of tag.");
    return true;
  }
  return false;
}