I'm posing this question of everyone on the TC but hoping Joseph might have some time to dig into it.
When I completed my action item from last Fridays's telecon to shorten the Ful Graph ABNF by condensing some of the rules (see the 2013-03-02 post to
https://wiki.oasis-open.org/xdi/XdiAbnf/Discussion), I also update it with Markus' simpler version of the collection-context and literal-context rules. See the bolded lines below (these most likely wrap in this email).
literal = literal-value / literal-ref
literal-value = literal-context "/!/" data-xref
literal-ref = literal-context "/!/()" <== NEW
context = peer / peer-relative-context / relative-context
peer = 1*xref
peer-relative-context = peer relative-context
relative-context = 1*( singleton / ( collection [ member ] ) )
collection-context = [ peer ] *( singleton / ( collection [ member ] ) ) collection
member-context = member [ relative-context ]
literal-context = [ peer ] *( singleton / ( collection [ member ] ) ) ( attribute-singleton / collection attribute-member )
The problem is that, as Markus noted, these don't actually work with the Interactive APG parser. I did a little testing this weekend and found it's because the "tail matching" pattern itself doesn't work. For example, I created this very simple test of an ABNF _expression_ that would match a string containing any combination of letters and digits as long as it ended it a digit:
ID = *( DIGIT / ALPHA ) DIGIT
ALPHA = %x41-5A / %x61-7A ; A-Z / a-z
DIGIT = %x30-39 ; 0-9
As I suspected, it doesn't work. As Markus detected last week, the greedy algorithm "sucks up" all the letters and digits in the *( DIGIT / ALPHA )rule and doesn't leave any to match the final DIGIT rule.
So, here's my question to Joseph (or anyone else who's deep enough into ABNF to answer it): is there an ABNF pattern I'm missing that's able to match the tail token in a sequence of tokens?
That's what we need for the collection-context and literal-context rules in the Full Graph ABNF.