protected function EasyRdf_Parser_Turtle::parsePrefixID

Parse a prefixID [4] @ignore

1 call to EasyRdf_Parser_Turtle::parsePrefixID()
EasyRdf_Parser_Turtle::parseDirective in drupal/core/vendor/easyrdf/easyrdf/lib/EasyRdf/Parser/Turtle.php
Parse a directive [3] @ignore

File

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

Class

EasyRdf_Parser_Turtle
Class to parse Turtle with no external dependancies.

Code

protected function parsePrefixID() {
  $this
    ->skipWSC();

  // Read prefix ID (e.g. "rdf:" or ":")
  $prefixID = '';
  while (true) {
    $c = $this
      ->read();
    if ($c == ':') {
      $this
        ->unread($c);
      break;
    }
    elseif (self::isWhitespace($c)) {
      break;
    }
    elseif ($c == -1) {
      throw new EasyRdf_Exception("Turtle Parse Error: unexpected end of file while reading prefix id");
    }
    $prefixID .= $c;
  }
  $this
    ->skipWSC();
  $this
    ->verifyCharacter($this
    ->read(), ":");
  $this
    ->skipWSC();

  // Read the namespace URI
  $namespace = $this
    ->parseURI();

  // Store local namespace mapping
  $this->namespaces[$prefixID] = $namespace['value'];
}