protected function EasyRdf_Parser_Turtle::parseDirective

Parse a directive [3] @ignore

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

File

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

Class

EasyRdf_Parser_Turtle
Class to parse Turtle with no external dependancies.

Code

protected function parseDirective() {

  // Verify that the first characters form the string "prefix"
  $this
    ->verifyCharacter($this
    ->read(), "@");
  $directive = '';
  $c = $this
    ->read();
  while ($c != -1 && !self::isWhitespace($c)) {
    $directive .= $c;
    $c = $this
      ->read();
  }
  if ($directive == "prefix") {
    $this
      ->parsePrefixID();
  }
  elseif ($directive == "base") {
    $this
      ->parseBase();
  }
  elseif (strlen($directive) == 0) {
    throw new EasyRdf_Exception("Turtle Parse Error: directive name is missing, expected @prefix or @base");
  }
  else {
    throw new EasyRdf_Exception("Turtle Parse Error: unknown directive \"@{$directive}\"");
  }
}