Subject: | Turtle parser - escaping backslashes doesn't seem to work |
As I read the Turtle spec (any version), the following should be parsed
as a single character literal consisting of one backslash:
"\\"
However, it's currently parsed as a two character string consisting of
two backslashes.
Ditto the long string form:
"""\\"""
I believe the following should work too, but it currently results in a
parse error:
'\\'
And the following also seems to be permitted by the latest W3C draft,
but was not allowed in the dajobe.com drafts of Turtle:
'''\\'''
The first two cases are covered by the attached test file.
This is fairly important as it's blocking RDF-RDB2RDF from passing test
R2RMLTC0010c from the R2RML test suite.
Subject: | turtle-test.pl |
use Test::More tests => 2;
use RDF::Trine 0.140;
my $model = RDF::Trine::Model->new;
RDF::Trine::Parser->new('Turtle')->parse_file_into_model(
'http://example.com/base/',
\*DATA,
$model,
);
$model->as_stream->each(sub
{
my $st = shift;
is(
$st->object->literal_value,
'\\',
$st->subject->uri,
);
});
__DATA__
# http://www.w3.org/TR/turtle/#sec-strings
<test1> <literal> "\\" .
<test2> <literal> """\\""" .