You are here

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

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

9 calls to EasyRdf_Parser_Turtle::verifyCharacterOrFail()
EasyRdf_Parser_Turtle::parseCollection in vendor/easyrdf/easyrdf/lib/EasyRdf/Parser/Turtle.php
Parses a collection [16], e.g: ( item1 item2 item3 ) @ignore
EasyRdf_Parser_Turtle::parseImplicitBlank in vendor/easyrdf/easyrdf/lib/EasyRdf/Parser/Turtle.php
Parses a blankNodePropertyList [15]
EasyRdf_Parser_Turtle::parseNodeID in vendor/easyrdf/easyrdf/lib/EasyRdf/Parser/Turtle.php
Parses a blank node ID, e.g: _:node1 @ignore
EasyRdf_Parser_Turtle::parsePrefixID in vendor/easyrdf/easyrdf/lib/EasyRdf/Parser/Turtle.php
Parse a prefixID [4] @ignore
EasyRdf_Parser_Turtle::parseQNameOrBoolean in vendor/easyrdf/easyrdf/lib/EasyRdf/Parser/Turtle.php
Parses qnames and boolean values, which have equivalent starting characters. @ignore

... See full list

File

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

Class

EasyRdf_Parser_Turtle
Class to parse Turtle with no external dependancies.

Code

protected function verifyCharacterOrFail($c, $expected) {
  if ($c == -1) {
    throw new EasyRdf_Parser_Exception("Turtle Parse Error: unexpected end of file", $this->line, $this->column);
  }
  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_Parser_Exception("Turtle Parse Error: {$msg}", $this->line, $this->column);
  }
}