You are here

protected function EasyRdf_Parser_Turtle::parseStatement 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::parseStatement()

Parse a statement [2] @ignore

1 call to EasyRdf_Parser_Turtle::parseStatement()
EasyRdf_Parser_Turtle::parse in vendor/easyrdf/easyrdf/lib/EasyRdf/Parser/Turtle.php
Parse Turtle into an EasyRdf_Graph

File

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

Class

EasyRdf_Parser_Turtle
Class to parse Turtle with no external dependancies.

Code

protected function parseStatement() {
  $directive = '';
  while (true) {
    $c = $this
      ->read();
    if ($c == -1 || self::isWhitespace($c)) {
      $this
        ->unread($c);
      break;
    }
    else {
      $directive .= $c;
    }
  }
  if (preg_match('/^(@|prefix$|base$)/i', $directive)) {
    $this
      ->parseDirective($directive);
    $this
      ->skipWSC();

    // SPARQL BASE and PREFIX lines do not end in .
    if ($directive[0] == "@") {
      $this
        ->verifyCharacterOrFail($this
        ->read(), ".");
    }
  }
  else {
    $this
      ->unread($directive);
    $this
      ->parseTriples();
    $this
      ->skipWSC();
    $this
      ->verifyCharacterOrFail($this
      ->read(), ".");
  }
}