You are here

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

Look for markup.

1 call to Tokenizer::markupDeclaration()
Tokenizer::tagOpen in vendor/masterminds/html5/src/HTML5/Parser/Tokenizer.php
Emit a tagStart event on encountering a tag.

File

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

Class

Tokenizer
The HTML5 tokenizer.

Namespace

Masterminds\HTML5\Parser

Code

protected function markupDeclaration() {
  if ($this->scanner
    ->current() != '!') {
    return false;
  }
  $tok = $this->scanner
    ->next();

  // Comment:
  if ($tok == '-' && $this->scanner
    ->peek() == '-') {
    $this->scanner
      ->next();

    // Consume the other '-'
    $this->scanner
      ->next();

    // Next char.
    return $this
      ->comment();
  }
  elseif ($tok == 'D' || $tok == 'd') {

    // Doctype
    return $this
      ->doctype('');
  }
  elseif ($tok == '[') {

    // CDATA section
    return $this
      ->cdataSection();
  }

  // FINISH
  $this
    ->parseError("Expected <!--, <![CDATA[, or <!DOCTYPE. Got <!%s", $tok);
  $this
    ->bogusComment('<!');
  return true;
}