Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Tokenizer.php

function 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.

Return value

bool

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. See section 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 646

Class

Tokenizer
The HTML5 tokenizer.

Namespace

Masterminds\HTML5\Parser

Code

protected function bogusComment($leading = '') {
    $comment = $leading;
    $tokens = $this->scanner
        ->charsUntil('>');
    if (false !== $tokens) {
        $comment .= $tokens;
    }
    $tok = $this->scanner
        ->current();
    if (false !== $tok) {
        $comment .= $tok;
    }
    $this->flushBuffer();
    $this->events
        ->comment($comment);
    $this->scanner
        ->consume();
    return true;
}
RSS feed
Powered by Drupal