protected function EasyRdf_Parser_Turtle::parseLongString in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/easyrdf/easyrdf/lib/EasyRdf/Parser/Turtle.php \EasyRdf_Parser_Turtle::parseLongString()
Parses a """long string""". This method requires that the first three characters have already been parsed.
@ignore
Parameters
string $closingCharacter The type of quote to use (either ' or "):
1 call to EasyRdf_Parser_Turtle::parseLongString()
- EasyRdf_Parser_Turtle::parseQuotedString in vendor/
easyrdf/ easyrdf/ lib/ EasyRdf/ Parser/ Turtle.php - Parses a quoted string, which is either a "normal string" or a """long string""". @ignore
File
- vendor/
easyrdf/ easyrdf/ lib/ EasyRdf/ Parser/ Turtle.php, line 719
Class
- EasyRdf_Parser_Turtle
- Class to parse Turtle with no external dependancies.
Code
protected function parseLongString($closingCharacter) {
$str = '';
$doubleQuoteCount = 0;
while ($doubleQuoteCount < 3) {
$c = $this
->read();
if ($c == -1) {
throw new EasyRdf_Parser_Exception("Turtle Parse Error: unexpected end of file while reading long string", $this->line, $this->column);
}
elseif ($c == $closingCharacter) {
$doubleQuoteCount++;
}
else {
$doubleQuoteCount = 0;
}
$str .= $c;
if ($c == '\\') {
// This escapes the next character, which might be a ' or "
$c = $this
->read();
if ($c == -1) {
throw new EasyRdf_Parser_Exception("Turtle Parse Error: unexpected end of file while reading long string", $this->line, $this->column);
}
$str .= $c;
}
}
return mb_substr($str, 0, -3, "UTF-8");
}