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

Breadcrumb

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

function Tokenizer::cdataSection

Handle a CDATA section.

Return value

bool

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

File

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

Class

Tokenizer
The HTML5 tokenizer.

Namespace

Masterminds\HTML5\Parser

Code

protected function cdataSection() {
    $cdata = '';
    $this->scanner
        ->consume();
    $chars = $this->scanner
        ->charsWhile('CDAT');
    if ('CDATA' != $chars || '[' != $this->scanner
        ->current()) {
        $this->parseError('Expected [CDATA[, got %s', $chars);
        return $this->bogusComment('<![' . $chars);
    }
    $tok = $this->scanner
        ->next();
    do {
        if (false === $tok) {
            $this->parseError('Unexpected EOF inside CDATA.');
            $this->bogusComment('<![CDATA[' . $cdata);
            return true;
        }
        $cdata .= $tok;
        $tok = $this->scanner
            ->next();
    } while (!$this->scanner
        ->sequenceMatches(']]>'));
    // Consume ]]>
    $this->scanner
        ->consume(3);
    $this->events
        ->cdata($cdata);
    return true;
}
RSS feed
Powered by Drupal