You are here

protected function EasyRdf_Parser_Turtle::parseDirective in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/easyrdf/easyrdf/lib/EasyRdf/Parser/Turtle.php \EasyRdf_Parser_Turtle::parseDirective()

Parse a directive [3] @ignore

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

File

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

Class

EasyRdf_Parser_Turtle
Class to parse Turtle with no external dependancies.

Code

protected function parseDirective($directive) {
  $directive = strtolower($directive);
  if ($directive == "prefix" || $directive == '@prefix') {
    $this
      ->parsePrefixID();
  }
  elseif ($directive == "base" || $directive == '@base') {
    $this
      ->parseBase();
  }
  elseif (mb_strlen($directive, "UTF-8") == 0) {
    throw new EasyRdf_Parser_Exception("Turtle Parse Error: directive name is missing, expected @prefix or @base", $this->line, $this->column);
  }
  else {
    throw new EasyRdf_Parser_Exception("Turtle Parse Error: unknown directive \"{$directive}\"", $this->line, $this->column);
  }
}