W3C home > Mailing lists > Public > ietf-http-wg@w3.org > April to June 2008

Re: ABNF switch: list rules

From: Julian Reschke <julian.reschke@gmx.de>
Date: Sat, 24 May 2008 10:10:12 +0200
Message-ID: <4837CD64.3090602@gmx.de>
To: "Zed A. Shaw" <zedshaw@zedshaw.com>
CC: HTTP Working Group <ietf-http-wg@w3.org>

Zed A. Shaw wrote:
> That's actually a common production in programming languages that have
> a ; to separate expressions.  They would always have a production that
> says something like "a program is a list of expressions separated by ;
> and a ; on its own is an empty expression".
> The only thing is most parsers and lexers have a way to ignore
> whitespace during operation, so they wouldn't need to include the LWS.
> Based on that, you could rewrite it like this to be a bit clearer and
> potentially reusable for other similar lists:
> AC-QValue = ";" "q" "=" qvalue
> AC-Type = (charset | "*")
> AC-Expression = AC-Type AC-QValue?

AC-Expression = AC-Type [AC-QValue]

> AC-Element = *LWS [AC-Expression] [","]
> Accept-Charset = "Accept-Charset" ":" *(AC-Element)
> Assuming I got the syntax right (didn't refresh my memory about ABNF),
> it's effectively saying:
> "AC is 'Accept-Charset:' followed by any number of elements.  Elements
> have any amount of leading white-space, an optional expression, and an
> optional comma.  Expressions have a type and optional q-value."

Right, but RFC2616 requires that the list includes at least one 
none-empty element :-)

> You should then be able to sprinkle LWS production where they belong.

BR, Julian
Received on Saturday, 24 May 2008 08:15:32 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 27 April 2012 06:50:48 GMT