protected function EasyRdf_Parser_Turtle::verifyCharacter

Verifies that the supplied character $c is one of the expected characters specified in $expected. This method will throw a exception if this is not the case. @ignore

10 calls to EasyRdf_Parser_Turtle::verifyCharacter()
EasyRdf_Parser_Turtle::parseCollection in drupal/core/vendor/easyrdf/easyrdf/lib/EasyRdf/Parser/Turtle.php
Parses a collection [16], e.g: ( item1 item2 item3 ) @ignore
EasyRdf_Parser_Turtle::parseDirective in drupal/core/vendor/easyrdf/easyrdf/lib/EasyRdf/Parser/Turtle.php
Parse a directive [3] @ignore
EasyRdf_Parser_Turtle::parseImplicitBlank in drupal/core/vendor/easyrdf/easyrdf/lib/EasyRdf/Parser/Turtle.php
Parses a blankNodePropertyList [15]
EasyRdf_Parser_Turtle::parseNodeID in drupal/core/vendor/easyrdf/easyrdf/lib/EasyRdf/Parser/Turtle.php
Parses a blank node ID, e.g: _:node1 @ignore
EasyRdf_Parser_Turtle::parsePrefixID in drupal/core/vendor/easyrdf/easyrdf/lib/EasyRdf/Parser/Turtle.php
Parse a prefixID [4] @ignore

... See full list

File

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

Class

EasyRdf_Parser_Turtle
Class to parse Turtle with no external dependancies.

Code

protected function verifyCharacter($c, $expected) {
  if ($c == -1) {
    throw new EasyRdf_Exception("Turtle Parse Error: unexpected end of file");
  }
  elseif (strpbrk($c, $expected) === false) {
    $msg = 'expected ';
    for ($i = 0; $i < strlen($expected); $i++) {
      if ($i > 0) {
        $msg .= " or ";
      }
      $msg .= '\'' . $expected[$i] . '\'';
    }
    $msg .= ", found '{$c}'";
    throw new EasyRdf_Exception("Turtle Parse Error: {$msg}");
  }
}