aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-04-23 19:08:03 +0000
committerDavid Robillard <d@drobilla.net>2011-04-23 19:08:03 +0000
commit82fdce9e8aa514710b349d3862148c7309d0ba36 (patch)
tree13e78235fd071da9139ffb6ac17f43fe282a8ffa
parentecc3adb41d4c116d4eb790b46eeabbbc72daae64 (diff)
downloadserd-82fdce9e8aa514710b349d3862148c7309d0ba36.tar.gz
serd-82fdce9e8aa514710b349d3862148c7309d0ba36.tar.bz2
serd-82fdce9e8aa514710b349d3862148c7309d0ba36.zip
Fix parsing of language tags with several hyphens.
git-svn-id: http://svn.drobilla.net/serd/trunk@146 490d8e77-9747-427b-9fa3-0b8f29cee8a0
-rw-r--r--src/reader.c2
-rw-r--r--tests/test-lang.out1
-rw-r--r--tests/test-lang.ttl3
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 @@
<http://example.org/test-lang#thing> <http://example.org/test-lang#greeting> "Hello"@en .
<http://example.org/test-lang#thing> <http://example.org/test-lang#greeting> "Howdy"@en-us .
<http://example.org/test-lang#thing> <http://example.org/test-lang#greeting> "Bonjour"@fr .
+<http://example.org/test-lang#thing> <http://example.org/test-lang#greeting> "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 .