protected function EasyRdf_Parser_Turtle::parseValue

Parses an RDF value. This method parses uriref, qname, node ID, quoted literal, integer, double and boolean. @ignore

4 calls to EasyRdf_Parser_Turtle::parseValue()
EasyRdf_Parser_Turtle::parseObject in drupal/core/vendor/easyrdf/easyrdf/lib/EasyRdf/Parser/Turtle.php
Parse a object [12] @ignore
EasyRdf_Parser_Turtle::parsePredicate in drupal/core/vendor/easyrdf/easyrdf/lib/EasyRdf/Parser/Turtle.php
Parse a predicate [11] @ignore
EasyRdf_Parser_Turtle::parseQuotedLiteral in drupal/core/vendor/easyrdf/easyrdf/lib/EasyRdf/Parser/Turtle.php
Parses a quoted string, optionally followed by a language tag or datatype.
EasyRdf_Parser_Turtle::parseSubject in drupal/core/vendor/easyrdf/easyrdf/lib/EasyRdf/Parser/Turtle.php
Parse a subject [10] @ignore

File

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

Class

EasyRdf_Parser_Turtle
Class to parse Turtle with no external dependancies.

Code

protected function parseValue() {
  $c = $this
    ->peek();
  if ($c == '<') {

    // uriref, e.g. <foo://bar>
    return $this
      ->parseURI();
  }
  elseif ($c == ':' || self::isPrefixStartChar($c)) {

    // qname or boolean
    return $this
      ->parseQNameOrBoolean();
  }
  elseif ($c == '_') {

    // node ID, e.g. _:n1
    return $this
      ->parseNodeID();
  }
  elseif ($c == '"' or $c == "'") {

    // quoted literal, e.g. "foo" or """foo""" or 'foo' or '''foo'''
    return $this
      ->parseQuotedLiteral($c);
  }
  elseif (ctype_digit($c) || $c == '.' || $c == '+' || $c == '-') {

    // integer or double, e.g. 123 or 1.2e3
    return $this
      ->parseNumber();
  }
  elseif ($c == -1) {
    throw new EasyRdf_Exception("Turtle Parse Error: unexpected end of file while reading value");
  }
  else {
    throw new EasyRdf_Exception("Turtle Parse Error: expected an RDF value here, found '{$c}'");
  }
}