aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/reader.c10
-rw-r--r--tests/tests-ttl/langtagged_LONG_with_subtag.nt1
-rw-r--r--tests/tests-ttl/langtagged_LONG_with_subtag.ttl3
-rw-r--r--tests/tests-ttl/manifest.ttl8
4 files changed, 16 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, '^');
diff --git a/tests/tests-ttl/langtagged_LONG_with_subtag.nt b/tests/tests-ttl/langtagged_LONG_with_subtag.nt
new file mode 100644
index 00000000..629cbf42
--- /dev/null
+++ b/tests/tests-ttl/langtagged_LONG_with_subtag.nt
@@ -0,0 +1 @@
+<http://example.org/ex#a> <http://example.org/ex#b> "Cheers"@en-UK .
diff --git a/tests/tests-ttl/langtagged_LONG_with_subtag.ttl b/tests/tests-ttl/langtagged_LONG_with_subtag.ttl
new file mode 100644
index 00000000..7fd527c4
--- /dev/null
+++ b/tests/tests-ttl/langtagged_LONG_with_subtag.ttl
@@ -0,0 +1,3 @@
+# Test long literal with lang tag
+@prefix : <http://example.org/ex#> .
+:a :b """Cheers"""@en-UK .
diff --git a/tests/tests-ttl/manifest.ttl b/tests/tests-ttl/manifest.ttl
index 195edc9e..7b9a5f4b 100644
--- a/tests/tests-ttl/manifest.ttl
+++ b/tests/tests-ttl/manifest.ttl
@@ -286,6 +286,7 @@
<#LITERAL_LONG2_with_REVERSE_SOLIDUS>
<#turtle-syntax-bad-LITERAL2_with_langtag_and_datatype>
<#two_LITERAL_LONG2s>
+ <#langtagged_LONG_with_subtag>
# tests from David Robillard
# http://www.w3.org/2011/rdf-wg/wiki/Turtle_Candidate_Recommendation_Comments#c21
@@ -1902,6 +1903,13 @@
mf:result <two_LITERAL_LONG2s.nt> ;
.
+<#langtagged_LONG_with_subtag> rdf:type rdft:TestTurtleEval ;
+ mf:name "langtagged_LONG_with_subtag" ;
+ rdfs:comment "langtagged LONG with subtag \"\"\"Cheers\"\"\"@en-UK" ;
+ mf:action <langtagged_LONG_with_subtag.ttl> ;
+ mf:result <langtagged_LONG_with_subtag.nt> ;
+ .
+
# tests from David Robillard
# http://www.w3.org/2011/rdf-wg/wiki/Turtle_Candidate_Recommendation_Comments#c21
<#turtle-syntax-bad-blank-label-dot-end>