aboutsummaryrefslogtreecommitdiffstats
path: root/src/reader.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2013-03-30 15:34:51 +0000
committerDavid Robillard <d@drobilla.net>2013-03-30 15:34:51 +0000
commit326d672cc93ebea8309c98c4549d30e7dc9c2eba (patch)
tree6c35739d23d056eb2e75b0ec3e77d1af572ba7af /src/reader.c
parentd9015f088eb9fe9b2eeea2c2508bd0e0d94f709f (diff)
downloadserd-326d672cc93ebea8309c98c4549d30e7dc9c2eba.tar.gz
serd-326d672cc93ebea8309c98c4549d30e7dc9c2eba.tar.bz2
serd-326d672cc93ebea8309c98c4549d30e7dc9c2eba.zip
Implement case-insensitive language tags from new Turtle spec.
git-svn-id: http://svn.drobilla.net/serd/trunk@444 490d8e77-9747-427b-9fa3-0b8f29cee8a0
Diffstat (limited to 'src/reader.c')
-rw-r--r--src/reader.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/reader.c b/src/reader.c
index a2c900c7..6233cf30 100644
--- a/src/reader.c
+++ b/src/reader.c
@@ -736,12 +736,11 @@ read_PN_PREFIX(SerdReader* reader, Ref dest)
return SERD_FAILURE;
}
-// [29] language ::= [a-z]+ ('-' [a-z0-9]+ )*
static Ref
-read_language(SerdReader* reader)
+read_LANGTAG(SerdReader* reader)
{
uint8_t c = peek_byte(reader);
- if (!in_range(c, 'a', 'z')) {
+ if (!is_alpha(c)) {
return r_err(reader, SERD_ERR_BAD_SYNTAX, "unexpected `%c'\n", c);
}
Ref ref = push_node(reader, SERD_LITERAL, "", 0);
@@ -751,8 +750,7 @@ read_language(SerdReader* reader)
}
while (peek_byte(reader) == '-') {
push_byte(reader, ref, eat_byte_safe(reader, '-'));
- while ((c = peek_byte(reader)) && (
- in_range(c, 'a', 'z') || in_range(c, '0', '9'))) {
+ while ((c = peek_byte(reader)) && (is_alpha(c) || is_digit(c))) {
push_byte(reader, ref, eat_byte_safe(reader, c));
}
}
@@ -916,7 +914,7 @@ read_literal(SerdReader* reader, Ref* dest,
switch (peek_byte(reader)) {
case '@':
eat_byte_safe(reader, '@');
- TRY_THROW(*lang = read_language(reader));
+ TRY_THROW(*lang = read_LANGTAG(reader));
break;
case '^':
eat_byte_safe(reader, '^');