protected function EasyRdf_Parser_Turtle::parseURI

Parses a URI / IRI @ignore

3 calls to EasyRdf_Parser_Turtle::parseURI()
EasyRdf_Parser_Turtle::parseBase in drupal/core/vendor/easyrdf/easyrdf/lib/EasyRdf/Parser/Turtle.php
Parse base [5] @ignore
EasyRdf_Parser_Turtle::parsePrefixID in drupal/core/vendor/easyrdf/easyrdf/lib/EasyRdf/Parser/Turtle.php
Parse a prefixID [4] @ignore
EasyRdf_Parser_Turtle::parseValue in drupal/core/vendor/easyrdf/easyrdf/lib/EasyRdf/Parser/Turtle.php
Parses an RDF value. This method parses uriref, qname, node ID, quoted literal, integer, double and boolean. @ignore

File

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

Class

EasyRdf_Parser_Turtle
Class to parse Turtle with no external dependancies.

Code

protected function parseURI() {
  $uri = '';

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

  // Read up to the next '>' character
  while (true) {
    $c = $this
      ->read();
    if ($c == '>') {
      break;
    }
    elseif ($c == -1) {
      throw new EasyRdf_Exception("Turtle Parse Error: unexpected end of file while reading URI");
    }
    $uri .= $c;
    if ($c == '\\') {

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

  // Unescape any escape sequences
  $uri = $this
    ->unescapeString($uri);
  return array(
    'type' => 'uri',
    'value' => $this
      ->resolve($uri),
  );
}