Joseph, this is really cool!
It also highlights the important decision we have to make about bare literals. Seeing it put this way makes it even clearer how streamlined the ABNF can be if we allow bare literals.
Over the weekend I also had an idea about how to deal with the bare literal problem in the first segment of an XDI address when it exists in the wild (which may be an edge case, but still one we need to deal with).
The idea is for the xdi-text rule that I propose in
https://wiki.oasis-open.org/xdi/XdiAbnf/Discussion (which is basically to enclose XDI addresses or XDI JSON documents that appear running text insidesquare brackets to make them easy to recognize and parse) to use
an additional forward slash to prefix the first segment of an XDI address. So instead of an XDI text block that contains an XDI statement consisting of all bare literals looking like:
[abc/def/xyz]
....it would look like this:
[/abc/def/xyz]
The reason I particularly like this is that now an XDI text block in any running text or markup document would be recognizable using just two rules:
- An embedded XDI address would always start with [/
- An embedded XDI JSON document would always start with [{
Examples of the first rule:
Example of the second rule:
If this approach can solve the problem of bare literals being allowed at the start of a first segment, then the question is: should we allow bare literals at the beginning of any segment in order to support this very streamlined ABNF parsing?
The second question is: should we stay with the current approach of just delimiting an IRI inside a cross-reference by looking for the colon following the scheme name (which is required by IRI syntax), or should we require a leading delimiter? My gut is the same as Joseph's here, which is that it is okay to parse for the colon following the IRI scheme name. Even though this is a little bit slower than just looking for a leading colon, it is simpler because it only requires "wrapping" the URI in parentheses.
How do others feel about these two questions?
=Drummond