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

> 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