Re: v11-03 COMMENT: 18.1 Accept

Dave Kristol:
>
>Two questions about the grammar.
>
>       Accept         = "Accept" ":" #(
>                             media-range
>                             [ ( ":" | ";" 
>                               range-parameter
>                               *( ";" range-parameter ) ]
>                            | extension-token )
>
>
>1) Should that be *( (":" | ";") range-parameter ) ?

That would also work, but it would even be more horrible.  I have
received mixed comments about the : stuff at the web conference.  Some
people like it, some people don't.  The reason for having it is to get
rid of a potential syntactic ambiguity: some (future) MIME types could
have numeric parameters called `q'.  Sure, the solution is horrible.
There is actually another solution, that you may call less or more
horrible, depending on the parsing technology you use.  See below.

>2) Is <extension-token> really useful? 

Yes.  I have use for such an extension-token in my transparent content
negotiation design.  Of course, I could also put it in another header,
or even in its own header, but I think it is nicest in Accept.

> Isn't it syntactically ambiguous?

No. A media-range always has a / in it, an extension-token never has a
/ in it.

>(Okay, okay, so it's LR(1).  That's messy, if not unprecedented.)

>It would be nice to have an example that shows both parameters and
>range-parameters, such as:
>        text/html; level=1: q=0.9, text/html; level=2: q=1.0

Yes.

 ---

Other solution to the syntactic ambiguity problem:

       Accept         = "Accept" ":" #(
                             media-range
                             [ range-parameters ] )

       media-range    = ( "*/*"
                        | ( type "/" "*" )
                        | ( type "/" subtype )
                        ) *( ";" parameter )

       range-parameters =  ( ";" "q" "=" qvalue )
                          *(";" extension-range-parameter )

       extension-range-parameter = ( token "=" token )

       extension-token = token

together with the text:

A media-range which includes a parameter with the attribute name "q"
MUST be followed by a range-parameters part.  This rule is meant to
disambiguate the parsing of such constructs.  An example is:

       text/x-example;q=0;r=3;q=1;r=4

which is "text/x-example;q=0;r=3" with a quality value of 1.

In my opinion, It is not yet too late to switch to this solution; I
could propose appropriate edits to Jim Gettys if many people on this
list say they like it better than the solution with the colon.

>Dave Kristol

Koen.

Received on Monday, 13 May 1996 14:08:07 UTC