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

Breadcrumb

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

function Tokenizer::readUntilSequence

Read from the input stream until we get to the desired sequene or hit the end of the input stream.

Parameters

string $sequence:

Return value

string

1 call to Tokenizer::readUntilSequence()
Tokenizer::rawText in vendor/masterminds/html5/src/HTML5/Parser/Tokenizer.php
Read text in RAW mode.

File

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

Class

Tokenizer
The HTML5 tokenizer.

Namespace

Masterminds\HTML5\Parser

Code

protected function readUntilSequence($sequence) {
    $buffer = '';
    // Optimization for reading larger blocks faster.
    $first = substr($sequence, 0, 1);
    while (false !== $this->scanner
        ->current()) {
        $buffer .= $this->scanner
            ->charsUntil($first);
        // Stop as soon as we hit the stopping condition.
        if ($this->scanner
            ->sequenceMatches($sequence, false)) {
            return $buffer;
        }
        $buffer .= $this->scanner
            ->current();
        $this->scanner
            ->consume();
    }
    // If we get here, we hit the EOF.
    $this->parseError('Unexpected EOF during text read.');
    return $buffer;
}
RSS feed
Powered by Drupal