RE: Collected ABNF for HTTPbis

Bjoern Hoehrmann wrote:
> * Brian Smith wrote:
> >There are only four places that allow empty lists, and they are all of
> the
> >same form as "TE":
> >
> >     TE        = "TE" ":" OWS TE-v
> >     TE-v      = #t-codings
> >
> >They all can be rewritten using that expansion:
> >
> >     TE        = "TE" ":" OWS [TE-v]
> >     TE-v      = t-codings (COMMA-ows t-codings)*
> >
> >Every other use is of the form 1#rule.
> 
> I am not sure what you are trying to say here. This is a matter of
> empty list items, not empty lists and the difference between 0#rule and
> 1#rule is the difference between [ 1#rule ] and 1#rule. Your rewrite
> disallows constructs that are valid under RFC 2616 and the current draft
> for which support is required and recommended respectively.

I understand what you mean now. I grabbed the wrong expansion from the spec;
I should have started with the more complicated one:

   #element  => [ ( "," / element ) *( OWS "," [ OWS element ] ) ]
   1#element => *( "," OWS ) element *( OWS "," [ OWS element ] )

which is effectively (considering the contexts in which those rules are
used) just:

   #element  => [element] *(list-sep [element])
   1#element => *LIST-SEP element *(LIST-SEP [element])
   LIST-SEP  => OWS "," OWS

Which, desugared, results in rules such as:

   TE        => "TE" ":" OWS TE-v
   TE-v      => [t-codings] *(LIST-SEP [t-codings])

I do admit that isn't super readable. But, the naming "-v" convention
(probably better "-list") and the avoidance of an ABNF extension make up for
it. If getting rid of the #rule extension avoids having to deal with the
collected ABNF, then this is a reasonable tradeoff. 

- Brian

Received on Monday, 18 May 2009 04:07:37 UTC