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

Breadcrumb

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

function Tokenizer::comment

Read a comment. Expects the first tok to be inside of the comment.

Return value

bool

1 call to Tokenizer::comment()
Tokenizer::markupDeclaration in vendor/masterminds/html5/src/HTML5/Parser/Tokenizer.php
Look for markup.

File

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

Class

Tokenizer
The HTML5 tokenizer.

Namespace

Masterminds\HTML5\Parser

Code

protected function comment() {
    $tok = $this->scanner
        ->current();
    $comment = '';
    // <!-->. Emit an empty comment because 8.2.4.46 says to.
    if ('>' == $tok) {
        // Parse error. Emit the comment token.
        $this->parseError("Expected comment data, got '>'");
        $this->events
            ->comment('');
        $this->scanner
            ->consume();
        return true;
    }
    // Replace NULL with the replacement char.
    if ("\x00" == $tok) {
        $tok = UTF8Utils::FFFD;
    }
    while (!$this->isCommentEnd()) {
        $comment .= $tok;
        $tok = $this->scanner
            ->next();
    }
    $this->events
        ->comment($comment);
    $this->scanner
        ->consume();
    return true;
}
RSS feed
Powered by Drupal