You are here

protected function EasyRdf_Parser_Turtle::parseQuotedString in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/easyrdf/easyrdf/lib/EasyRdf/Parser/Turtle.php \EasyRdf_Parser_Turtle::parseQuotedString()

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

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

File

vendor/easyrdf/easyrdf/lib/EasyRdf/Parser/Turtle.php, line 643

Class

EasyRdf_Parser_Turtle
Class to parse Turtle with no external dependancies.

Code

protected function parseQuotedString() {
  $result = null;
  $c1 = $this
    ->read();

  // First character should be ' or "
  $this
    ->verifyCharacterOrFail($c1, "\"\\'");

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

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

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

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