I'd point out that while this may make the ABNF less ambiguous, it now
makes parsing XRIs more complicated. Now, we don't just check the first
character to see if it's a GCS character, we also have to check the
second character (when the GCS char is !) to see if it is ! or something
else.
Just something to consider. I don't really have a strong opinion either
way - both have their negatives.
-Gabe
> -----Original Message-----
> From: Drummond Reed [mailto:]
> Sent: Tuesday, March 08, 2005 9:55 AM
> To:
> Subject: [xri] Solution for GCS ! ambiguity in ABNF
>
> In doing the final review of the 05 Syntax spec, a solution to the
> longstanding issue about the ambiguity of "!" was identified.
> This email
> briefly summarizes the issue and the solution. The proposed
> change to the
> ABNF that fixes it has been closely reviewed by Dave, Chetan,
> and myself, so
> we plan to roll this change into the 06 draft unless anyone has an
> objection.
>
> SUMMARY OF THE ISSUE
>
> For simplicities sake, the current ABNF treats "!" the same
> as the other GCS
> characters, when in fact the intent all along has been that
> unlike the other
> GCS characters, "!" should only be followed by a persistent
> subsegment,
> i.e., that as an absolute XRI, you could only have "!!123"
> and never "!123".
> It should be unambiguous that the latter is a relative persistent XRI
> subsegment.
>
> However the current ABNF does not enforce this rule, so a relative XRI
> starting with "!" is currently ambiguous. As a result in the
> 05 draft Dave
> needed to add a section (2.4.7) that explained that you can't
> just write
> "!123" as a relative subsegment, but instead you need to
> prefix it with
> "./!123" to make sure it's not ambiguous.
>
> Because this is ugly, and because it requires treating relative
> !sub-segments differently than relative *sub-segments, the following
> solution was identified.
>
> PROPOSED SOLUTION
>
> The solution involves changing six lines of the ABNF, with
> five of these
> changes being just to make room for the one new production
> that actually
> eliminates the ambiguity. Following is a complete analysis.
>
> First, below is the current ABNF from the authority and path sections:
>
> ****CURRENT ABNF****
>
> xri-authority = gcs-authority / xref-authority
>
> gcs-authority = gcs-char xri-segment
>
> xref-authority = xref *xri-subseg
>
> gcs-char = "=" / "@" / "+" / "$" / "!"
>
> xri-path = xri-path-absolute
> / xri-path-noscheme
> / ipath-empty
>
> xri-path-absolute = "/" [ xri-segment-nz *( "/" xri-segment ) ]
>
> xri-path-noscheme = xri-subseg-od-nx *xri-subseg-nc
> *( "/" xri-segment )
>
> xri-segment = xri-subseg-od *xri-subseg
>
> xri-segment-nz = xri-subseg-od-nz *xri-subseg
>
> xri-subseg = ( "*" / "!" ) (xref / *xri-pchar)
>
> xri-subseg-nc = ( "*" / "!" ) (xref / *xri-pchar-nc)
>
> xri-subseg-od = [ "*" / "!" ] (xref / *xri-pchar)
>
> xri-subseg-od-nz = [ "*" / "!" ] (xref / 1*xri-pchar)
>
> xri-subseg-od-nx = [ "*" / "!" ] 1*xri-pchar-nc
>
> xri-gen-delims = ":" / "/" / "?" / "#" / "[" / "]" / "("
> / ")" / "*" / gcs-char
>
> ***END***
>
> Second, following are the six changed lines of ABNF that
> would be needed.
> Two of them are revisions to current productions (gcs-authority and
> xri-gen-delims), two are renamed productions (gcs-char
> renamed rgcs-char,
> and gsc-authority renamed rgcs-authority), and two are new productions
> (pgcs-authority and xri-subseg-pt-nz). Note also that
> "xri-subseg-pt-nz" is
> named to match the rest of the "xri-subseg" productions, with the "pt"
> standing for "persistent".
>
> Also note that the only changes in the rgcs-char and xri-gen-delims
> productions are to move "!" out of the rgcs-char because of
> its special
> treatment vs. the other reassignable GCS characters.
>
> ****LINES THAT WOULD CHANGE IN THE REVISED ABNF****
>
> gcs-authority = pgcs-authority / rgcs-authority
>
> pgcs-authority = "!" xri-subseg-pt-nz *xri-subseg
>
> xri-subseg-pt-nz = "!" (xref / 1*xri-pchar)
>
> rgcs-authority = rgcs-char xri-segment
>
> rgcs-char = "=" / "@" / "+" / "$"
>
> xri-gen-delims = ":" / "/" / "?" / "#" / "[" / "]" / "("
> / ")" / "*" / "!" / rgcs-char
>
> ****END****
>
> The net effect of this change is simply to separate out the special
> restriction on using "!" as a GCS character. Because of the new
> pgcs-authority production, it is no longer ambiguous that a
> single bang
> represents a relative persistent subsegment, i.e., it is fine to write
> "!123".
>
> To see it all in context, following is the fully revised ABNF
> for this set
> of productions (again, only the six lines above have changed):
>
> ****FULL REVISED ABNF****
>
> xri-authority = gcs-authority / xref-authority
>
> gcs-authority = pgcs-authority / rgcs-authority
>
> pgcs-authority = "!" xri-subseg-pt-nz *xri-subseg
>
> rgcs-authority = rgcs-char xri-segment
>
> xref-authority = xref *xri-subseg
>
> rgcs-char = "=" / "@" / "+" / "$"
>
> xri-path = xri-path-absolute
> / xri-path-noscheme
> / ipath-empty
>
> xri-path-absolute = "/" [ xri-segment-nz *( "/" xri-segment ) ]
>
> xri-path-noscheme = xri-subseg-od-nx *xri-subseg-nc
> *( "/" xri-segment )
>
> xri-segment = xri-subseg-od *xri-subseg
>
> xri-segment-nz = xri-subseg-od-nz *xri-subseg
>
> xri-subseg = ( "*" / "!" ) (xref / *xri-pchar)
>
> xri-subseg-nc = ( "*" / "!" ) (xref / *xri-pchar-nc)
>
> xri-subseg-od = [ "*" / "!" ] (xref / *xri-pchar)
>
> xri-subseg-od-nz = [ "*" / "!" ] (xref / 1*xri-pchar)
>
> xri-subseg-od-nx = [ "*" / "!" ] 1*xri-pchar-nc
>
> xri-subseg-pt-nz = "!" (xref / 1*xri-pchar)
>
> xri-gen-delims = ":" / "/" / "?" / "#" / "[" / "]" / "("
> / ")" / "*" / "!" / rgcs-char
>
> ***END***
>
> =Drummond
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:
>
>