Following links and snippets are about clojure.edn but because this logic is the same in clojure it also affects clojure reader as well.
Here is how symbol pattern is defined:
[:]?([\D&&[^/]].*/)?(/|[\D&&[^/]][^/]*)
It is eagerly matching prefix until the last slash character, after that it matches symbol name.
Then there is a wrong analysis of matched groups happen: ns is incorrectly set to everything until the last slash with validation that it is not ends with :/
Then in Symbol.intern call there is an another lookup for the first slash to split symbol into namespace and name.
The result is that keywords like this: ":/-/-", end up with namespace set to empty string "".
Looks like the least intrusive way to fix it is to use the same logic to find namespace borders in both places:
- during symbol reading, lookup the first / to set ns instead of using the first matching group
- in symbol interning the logic is correct
Another option is to use different regular expression:
[:]?([\D&&[^/]][^/]*/)?(/|[\D&&[^/]].*[^/])
This matches symbol prefix til the first slash keeping restriction "name can't end with slash".