From 82fdce9e8aa514710b349d3862148c7309d0ba36 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 23 Apr 2011 19:08:03 +0000 Subject: Fix parsing of language tags with several hyphens. git-svn-id: http://svn.drobilla.net/serd/trunk@146 490d8e77-9747-427b-9fa3-0b8f29cee8a0 --- src/reader.c | 2 +- tests/test-lang.out | 1 + tests/test-lang.ttl | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/reader.c b/src/reader.c index 114b53af..615f4d46 100644 --- a/src/reader.c +++ b/src/reader.c @@ -773,7 +773,7 @@ read_language(SerdReader reader) while ((c = peek_byte(reader)) && in_range(c, 'a', 'z')) { push_byte(reader, str, eat_byte(reader, c)); } - if (peek_byte(reader) == '-') { + while (peek_byte(reader) == '-') { push_byte(reader, str, eat_byte(reader, '-')); while ((c = peek_byte(reader)) && ( in_range(c, 'a', 'z') || in_range(c, '0', '9'))) { diff --git a/tests/test-lang.out b/tests/test-lang.out index a75749b0..c36dda42 100644 --- a/tests/test-lang.out +++ b/tests/test-lang.out @@ -1,3 +1,4 @@ "Hello"@en . "Howdy"@en-us . "Bonjour"@fr . + "Guten Tag"@de-latn-de . diff --git a/tests/test-lang.ttl b/tests/test-lang.ttl index a4a6c77f..f7c2727f 100644 --- a/tests/test-lang.ttl +++ b/tests/test-lang.ttl @@ -2,4 +2,5 @@ :thing :greeting "Hello"@en ; :greeting "Howdy"@en-us ; - :greeting "Bonjour"@fr . + :greeting "Bonjour"@fr ; + :greeting "Guten Tag"@de-latn-de . -- cgit v1.2.1