protected function EasyRdf_Parser_Turtle::parseQuotedString

Parses a quoted string, which is either a "normal string" or a """long string""".

@ignore

Parameters

string $quote The type of quote to use (either ' or "):

1 call to EasyRdf_Parser_Turtle::parseQuotedString()
EasyRdf_Parser_Turtle::parseQuotedLiteral in drupal/core/vendor/easyrdf/easyrdf/lib/EasyRdf/Parser/Turtle.php
Parses a quoted string, optionally followed by a language tag or datatype.

File

drupal/core/vendor/easyrdf/easyrdf/lib/EasyRdf/Parser/Turtle.php, line 576

Class

EasyRdf_Parser_Turtle
Class to parse Turtle with no external dependancies.

Code

protected function parseQuotedString($quote) {
  $result = null;

  // First character should be ' or "
  $this
    ->verifyCharacter($this
    ->read(), $quote);

  // Check for long-string, which starts and ends with three double quotes
  $c2 = $this
    ->read();
  $c3 = $this
    ->read();
  if ($c2 == $quote && $c3 == $quote) {

    // Long string
    $result = $this
      ->parseLongString($quote);
  }
  else {

    // Normal string
    $this
      ->unread($c3);
    $this
      ->unread($c2);
    $result = $this
      ->parseString($quote);
  }

  // Unescape any escape sequences
  return $this
    ->unescapeString($result);
}