Re: [css3-background] Further correction to the <position> grammar

On Sun, Jan 22, 2012 at 2:53 PM, Brian Manthos <brianman@microsoft.com> wrote:
> TR
> [
>  [ top | bottom ]
> |
>  [ <percentage> | <length> | left | center | right ]
>  [ <percentage> | <length> | top | center | bottom ]?
> |
>  [ center | [ left | right ] [ <percentage> | <length> ]? ] &&
>  [ center | [ top | bottom ] [ <percentage> | <length> ]? ]
> ]
>
>
> ED (modified as per Tab below)
> [
>  [ left | center | right | top | bottom | <percentage> | <length> ]
> |
>  [ left | center | right | <percentage> | <length> ]
>  [ top | center | bottom | <percentage> | <length> ]
> |
>  [ center | [ left | right ] [ <percentage> | <length> ]? ] &&
>  [ center | [ top | bottom ] [ <percentage> | <length> ]? ]
> ]
>
>
> Marking the sub-clauses...
>
> TR
> (A)  [ top | bottom ]
> (B)  [ <percentage> | <length> | left | center | right ]
>  [ <percentage> | <length> | top | center | bottom ]?
> (C)  [ center | [ left | right ] [ <percentage> | <length> ]? ] &&
>  [ center | [ top | bottom ] [ <percentage> | <length> ]? ]
>
> ED(m)
> (A) [ left | center | right | top | bottom | <percentage> | <length> ]
> (B)  [ left | center | right | <percentage> | <length> ]
>  [ top | center | bottom | <percentage> | <length> ]
> (C)  [ center | [ left | right ] [ <percentage> | <length> ]? ] &&
>  [ center | [ top | bottom ] [ <percentage> | <length> ]? ]
>
>
> TRC and EDmC match, so let's ignore those for the moment.
>
>
> Unless I'm misreading it, (A) has become more complicated just so 1 character can be removed from (B).
>
>
> Tab, why is the ED version of (A)+(B) considered an improvement over the TR version of (A)+(B)?

Because it more closely matches the actual productions.  In the ED
version, the (A) clause covers all the 1-token productions, the (B)
clause covers most of the 2-token productions (with the exception
being [top|bottom] [left|right]), and the (C) clause covers everything
else.

On the other hand, in the TR version, the (A) clause covers two of the
1-token productions, while (B) covers the rest of the 1-token
productions and most of the 2-token productions, and then (C) covers
everything else.


> Shouldn't it be demonstrably better to be worth changing?

The productions are exactly equivalent, so this amounts to an
editorial change.  That said, I think the suggested version is easier
to read and understand.

~TJ

Received on Sunday, 22 January 2012 23:17:09 UTC