Skip to content

Commit f8013f6

Browse files
committed
Add syntax tests for codepoint escaping.
1 parent 831feb1 commit f8013f6

12 files changed

+147
-0
lines changed

sparql/sparql12/manifest.ttl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ trs:manifest rdf:type mf:Manifest ;
3333
""";
3434
mf:include (
3535
<grouping/manifest.ttl>
36+
<syntax-escaping/manifest.ttl>
3637
<syntax-triple-terms-negative/manifest.ttl>
3738
<syntax-triple-terms-positive/manifest.ttl>
3839
) .
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
SELECT * WHERE {
2+
?s ?p "\\u000Z"
3+
}
4+
5+
# \u000Z is an invalid escape sequence. It should either: be left as-is
6+
# as it does not match the escape syntax of `\u HEX HEX HEX HEX`; or
7+
# seen as a syntax error.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
PREFIX ns: <http://example.org/>
2+
SELECT * WHERE {
3+
?s ?p ns:id\u005c=123
4+
}
5+
6+
# the escape here produces '\' REVERSE SOLIDUS (U+5C)
7+
# its unescaping must lead to a Prefixed Name ns:id\=123 using an escaped
8+
# equals sign (U+3D), representing the IRI <http://example.org/id=123>.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
SELECT * WHERE {
2+
?s ?p "\\u0041"
3+
}
4+
# Legal codepoint escape of LATIN CAPITAL LETTER A (U+41), resulting in an
5+
# invalid backslash escape \A.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
SELECT * WHERE {
2+
?s ?p "\\u0074"
3+
}
4+
# Legal codepoint escape of LATIN SMALL LETTER T (U+74), resulting in a
5+
# valid backslash escape \t for CHARACTER TABULATION (U+9).
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
SELECT * WHERE {
2+
?s ?p "\u005C\u005Cn"
3+
}
4+
# Two legal codepoint escapes of REVERSE SOLIDUS (U+5C), resulting in a
5+
# valid backslash escape \\ for REVERSE SOLIDUS (U+5C) followed by 'n'.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
PREFIX og: <http://ogp.me/ns#>
2+
SELECT * WHERE {
3+
?page og:audio\u00253Atitle ?title
4+
}
5+
6+
# the escape here produces '%' PERCENT SIGN (U+25)
7+
# its unescaping must lead to a Prefixed Name og:audio%3Atitle which includes
8+
# the percent-encoding %3A (COLON).
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
SELECT\u0020*\U00000009WHERE {
2+
?s ?p "value"
3+
}
4+
5+
# the escapes here produce whitespace -- SPACESPACE (U+20) and
6+
# CHARACTER TABULATION (U+9) -- surrounding the `*` token in the
7+
# SELECT projection.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
SELECT * WHERE {
2+
?s ?p \u0022value"
3+
}
4+
5+
# the escape here produces QUOTATION MARK (U+22)
6+
# its unescaping must lead to the literal 'value'.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
\u0041\u0053\u004B\u0020\u007B\u007D
2+
3+
# The query `ASK {}` entirely encoded using codepoint escapes.

0 commit comments

Comments
 (0)