You are here

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

Consume malformed markup as if it were a comment. 8.2.4.44

The spec requires that the ENTIRE tag-like thing be enclosed inside of the comment. So this will generate comments like:

<!--&lt/+foo>-->

Parameters

string $leading: Prepend any leading characters. This essentially negates the need to backtrack, but it's sort of a hack.

5 calls to Tokenizer::bogusComment()
Tokenizer::cdataSection in vendor/masterminds/html5/src/HTML5/Parser/Tokenizer.php
Handle a CDATA section.
Tokenizer::doctype in vendor/masterminds/html5/src/HTML5/Parser/Tokenizer.php
Parse a DOCTYPE.
Tokenizer::endTag in vendor/masterminds/html5/src/HTML5/Parser/Tokenizer.php
Consume an end tag. 8.2.4.9
Tokenizer::markupDeclaration in vendor/masterminds/html5/src/HTML5/Parser/Tokenizer.php
Look for markup.
Tokenizer::processingInstruction in vendor/masterminds/html5/src/HTML5/Parser/Tokenizer.php
Handle a processing instruction.

File

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

Class

Tokenizer
The HTML5 tokenizer.

Namespace

Masterminds\HTML5\Parser

Code

protected function bogusComment($leading = '') {

  // TODO: This can be done more efficiently when the
  // scanner exposes a readUntil() method.
  $comment = $leading;
  $tok = $this->scanner
    ->current();
  do {
    $comment .= $tok;
    $tok = $this->scanner
      ->next();
  } while ($tok !== false && $tok != '>');
  $this
    ->flushBuffer();
  $this->events
    ->comment($comment . $tok);
  $this->scanner
    ->next();
  return true;
}