W3C home > Mailing lists > Public > www-style@w3.org > April 2014

Re: [css-values] The last grammar combinator - 1+ in order

From: Brad Kemper <brad.kemper@gmail.com>
Date: Wed, 23 Apr 2014 16:25:05 -0700
Message-Id: <E79836EB-62DA-43BF-87A1-852D74F372B3@gmail.com>
Cc: www-style list <www-style@w3.org>
To: "Tab Atkins Jr." <jackalmage@gmail.com>

> On Apr 17, 2014, at 5:27 PM, "Tab Atkins Jr." <jackalmage@gmail.com> wrote:
> 
> We can express "exactly one" as "a | b", and we can express 5 of the 6
> possibilities in {0+, 1+, all}กม{in order, any order}* .  The one thing
> we're missing is "1+, in order", which we can't write without
> duplication and honestly confusing grammar.
> 
> For example, the syntax for background-position-x takes a side keyword
> and/or a length/percentage.  You can specify either or both, but can't
> specify none.  Today, that requires writing something like:
> 
> [left | right] |
> [left | right]? [<length> | <percentage>]
> 
> I don't know about you, but I don't see that as saying "a keyword
> and/or a length/percentage".  It's hard to read, and means we're
> duplicating terms in the grammar, making it larger and even harder to
> read, or else requiring indirection through an intermediate grammar
> production.

How about this:

[left | right] | [<length> | <percentage>]{1}

...and we say that when a {positive number} or '+' appears after the square brackets, that you cannot legally less than one of those words.
Received on Wednesday, 23 April 2014 23:25:36 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:39:21 UTC