drobilla / serd

A lightweight C library for RDF syntax
https://gitlab.com/drobilla/serd
ISC License
88 stars 16 forks source link

Backslash escaped IRI local names are not parsed #13

Closed wouterbeek closed 6 years ago

wouterbeek commented 6 years ago

I'm posting here an issue related to an issue opened by @wonkydonky in the hdt-cpp project.

IIUC it is allowed to use backslash escaping in IRI local names, which would allow dots to appear as the first and/or last character of a local name (something that is not allowed without backslash escaping).

A simple example to illustrate this:

$ serdi -s "prefix : <x:x> :\. : : ."
error: (string):1:20: bad subject
drobilla commented 6 years ago

Sigh, yes, this is allowed in RDF 1.1 Turtle, for a weird specific set of characters that has nothing to do with Turtle and is only there because the SPARQL grammar is horribly designed and not extensible at all. Bonus points for grafting this on at the last minute and not actually updating the test suite to cover any of it. All of that and we still can't use slashes in local names. Concatenating strings should really not be this complicated!

Complaining aside, I will try to write a test suite and implement this mess when I get some time.

drobilla commented 6 years ago

This issue is specifically to do with only the special (nightmare to parse) case of a trailing dot in a local name.

drobilla commented 6 years ago

Fixed in f124a07