summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Beckett <dave@dajobe.org>2014-11-01 21:53:48 -0700
committerDave Beckett <dave@dajobe.org>2014-11-01 21:53:48 -0700
commit292998db469d079b118c2008bdae130eb89cab17 (patch)
tree785077cbd558ba7d52c55c5fcbac2db27275df5d
parentaad2305d1d29e2914040d5bcd995329bb1953663 (diff)
downloadraptor-292998db469d079b118c2008bdae130eb89cab17.tar.gz
Handle \r in TRiG "graph-name {"
Fixes Issue #0000584 http://bugs.librdf.org/mantis/view.php?id=584
-rw-r--r--src/turtle_lexer.l4
-rw-r--r--tests/trig/Makefile.am6
-rw-r--r--tests/trig/bug-584-dos.out1
-rw-r--r--tests/trig/bug-584-dos.trig2
-rw-r--r--tests/trig/bug-584-unix.out1
-rw-r--r--tests/trig/bug-584-unix.trig2
6 files changed, 12 insertions, 4 deletions
diff --git a/src/turtle_lexer.l b/src/turtle_lexer.l
index a6029522..be4b1e64 100644
--- a/src/turtle_lexer.l
+++ b/src/turtle_lexer.l
@@ -429,7 +429,7 @@ EXPONENT [eE][+-]?[0-9]+
yyterminate(); }
-{IRI}[\ \t\v\n]*("=")?[\ \t\v\n]*"{" {
+{IRI}[\ \t\v\r\n]*("=")?[\ \t\v\r\n]*"{" {
raptor_stringbuffer* sb;
unsigned char* uri_string;
@@ -461,7 +461,7 @@ EXPONENT [eE][+-]?[0-9]+
TURTLE_LEXER_OOM();
return GRAPH_NAME_LEFT_CURLY; }
-{QNAME}[\ \t\v\n]*("=")?[\ \t\v\n]*"{" {
+{QNAME}[\ \t\v\r\n]*("=")?[\ \t\v\r\n]*"{" {
while(1) {
int c = yytext[yyleng - 1];
if(c == '{' || c == ' ' || c=='\t' || c == '\v' || c == '\n' ||
diff --git a/tests/trig/Makefile.am b/tests/trig/Makefile.am
index e1d4c0d7..07515f30 100644
--- a/tests/trig/Makefile.am
+++ b/tests/trig/Makefile.am
@@ -21,10 +21,12 @@
#
TEST_FILES=\
-example1.trig example2.trig example3.trig bug370.trig bug451.trig
+example1.trig example2.trig example3.trig bug370.trig bug451.trig \
+bug-584-dos.trig bug-584-unix.trig
TEST_OUT_FILES=\
-example1.out example2.out example3.out bug370.out bug451.out
+example1.out example2.out example3.out bug370.out bug451.out \
+bug-584-dos.out bug-584-unix.out
# Used to make N-triples output consistent
BASE_URI=http://example.librdf.org/
diff --git a/tests/trig/bug-584-dos.out b/tests/trig/bug-584-dos.out
new file mode 100644
index 00000000..02aa5f5f
--- /dev/null
+++ b/tests/trig/bug-584-dos.out
@@ -0,0 +1 @@
+<http://example.org#this> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org#that> <http://example.org#graph> .
diff --git a/tests/trig/bug-584-dos.trig b/tests/trig/bug-584-dos.trig
new file mode 100644
index 00000000..3b239ca6
--- /dev/null
+++ b/tests/trig/bug-584-dos.trig
@@ -0,0 +1,2 @@
+<http://example.org#graph>
+ { <http://example.org#this> a <http://example.org#that> . }
diff --git a/tests/trig/bug-584-unix.out b/tests/trig/bug-584-unix.out
new file mode 100644
index 00000000..02aa5f5f
--- /dev/null
+++ b/tests/trig/bug-584-unix.out
@@ -0,0 +1 @@
+<http://example.org#this> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org#that> <http://example.org#graph> .
diff --git a/tests/trig/bug-584-unix.trig b/tests/trig/bug-584-unix.trig
new file mode 100644
index 00000000..256d45c0
--- /dev/null
+++ b/tests/trig/bug-584-unix.trig
@@ -0,0 +1,2 @@
+<http://example.org#graph>
+ { <http://example.org#this> a <http://example.org#that> . }