You are here

protected function Tokenizer::quotedString in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/masterminds/html5/src/HTML5/Parser/Tokenizer.php \Masterminds\HTML5\Parser\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 786

Class

Tokenizer
The HTML5 tokenizer.

Namespace

Masterminds\HTML5\Parser

Code

protected function quotedString($stopchars) {
  $tok = $this->scanner
    ->current();
  if ($tok == '"' || $tok == "'") {
    $this->scanner
      ->next();
    $ret = $this->scanner
      ->charsUntil($tok . $stopchars);
    if ($this->scanner
      ->current() == $tok) {
      $this->scanner
        ->next();
    }
    else {

      // Parse error because no close quote.
      $this
        ->parseError("Expected %s, got %s", $tok, $this->scanner
        ->current());
    }
    return $ret;
  }
  return false;
}