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

Breadcrumb

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

function Tokenizer::quotedString

Utility for reading a quoted string.

Parameters

string $stopchars Characters (in addition to a close-quote) that should stop the string.: E.g. sometimes '>' is higher precedence than '"' or "'".

Return value

mixed String if one is found (quotations omitted).

1 call to Tokenizer::quotedString()
Tokenizer::doctype in vendor/masterminds/html5/src/HTML5/Parser/Tokenizer.php
Parse a DOCTYPE.

File

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

Class

Tokenizer
The HTML5 tokenizer.

Namespace

Masterminds\HTML5\Parser

Code

protected function quotedString($stopchars) {
    $tok = $this->scanner
        ->current();
    if ('"' == $tok || "'" == $tok) {
        $this->scanner
            ->consume();
        $ret = $this->scanner
            ->charsUntil($tok . $stopchars);
        if ($this->scanner
            ->current() == $tok) {
            $this->scanner
                ->consume();
        }
        else {
            // Parse error because no close quote.
            $this->parseError('Expected %s, got %s', $tok, $this->scanner
                ->current());
        }
        return $ret;
    }
    return false;
}
RSS feed
Powered by Drupal