protected function EasyRdf_Parser_Turtle::parseString

Parses a "normal string". This method assumes that the first double quote has already been parsed.

@ignore

Parameters

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

1 call to EasyRdf_Parser_Turtle::parseString()
EasyRdf_Parser_Turtle::parseQuotedString in drupal/core/vendor/easyrdf/easyrdf/lib/EasyRdf/Parser/Turtle.php
Parses a quoted string, which is either a "normal string" or a """long string""".

File

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

Class

EasyRdf_Parser_Turtle
Class to parse Turtle with no external dependancies.

Code

protected function parseString($quote) {
  $str = '';
  while (true) {
    $c = $this
      ->read();
    if ($c == $quote) {
      break;
    }
    elseif ($c == -1) {
      throw new EasyRdf_Exception("Turtle Parse Error: unexpected end of file while reading string");
    }
    $str .= $c;
    if ($c == '\\') {

      // This escapes the next character, which might be a ' or a "
      $c = $this
        ->read();
      if ($c == -1) {
        throw new EasyRdf_Exception("Turtle Parse Error: unexpected end of file while reading string");
      }
      $str .= $c;
    }
  }
  return $str;
}