Re: [css3-background] Overly-clever background-position grammar

>> <bg-position>  = [
>>   [ top | bottom ]
>> |
>>   [ <percentage> | <length> | left | center | right ]
>>   [ <percentage> | <length> | top | center | bottom ]?
>> |
>>   [ center | [ left | right ] [ <percentage> | <length> ]? ] &&
>>   [ center | [ top | bottom ] [ <percentage> | <length> ]? ]
>> ]

This allows “left top”,   “left bottom”,   “left center”, 
           “right top”,  “right bottom”,  “right center”,
          “center top”, “center bottom”, “center center”,
but forbids “top left”, “bottom left”,   “center left”,
           “top right”, “bottom right”,  “center right”,
          “top center”, “bottom center”. 
Is this intended?

Reformulations

unconventional:

<bg-position>  = [
  [ <percentage> | <length> | left | center | right ]? &&
  [ <percentage> | <length> | top | center | bottom ]?
|
  [ center | [ left | right ] [ <percentage> | <length> ]? ] &&
  [ center | [ top | bottom ] [ <percentage> | <length> ]? ]
]

reordered:

<bg-position>  = [
             [ top | bottom ]
|
  [ center |   left | right  |  <percentage> | <length>    ]
  [ center |   top | bottom  |  <percentage> | <length>    ]?
|
  [ center | [ left | right ] [ <percentage> | <length> ]? ] &&
  [ center | [ top | bottom ] [ <percentage> | <length> ]? ]
]

regrouped:

<bg-position>  = [
  [ center |   left | right  |
               top | bottom  |  <percentage> | <length>    ]
|
  [ center |   left | right  |  <percentage> | <length>    ] &&
  [ center |   top | bottom  |  <percentage> | <length>    ]
|
  [ center | [ left | right ] [ <percentage> | <length> ]? ] &&
  [ center | [ top | bottom ] [ <percentage> | <length> ]? ]
]

verbose, no redundancy:

<bg-position>  = [
  [ center |   left | right  |
               top | bottom  |  <percentage> | <length>   ]
|
  [ center |   left | right  |  <percentage> | <length>   ] &&
  [ center |   top | bottom  |  <percentage> | <length>   ]
|
  [          [ left | right ] [ <percentage> | <length> ] ] &&
  [ center | [ top | bottom ]                             ]
|
  [ center | [ left | right ]                             ] &&
  [          [ top | bottom ] [ <percentage> | <length> ] ]
|
  [          [ left | right ] [ <percentage> | <length> ] ] &&
  [          [ top | bottom ] [ <percentage> | <length> ] ]
]

compact verbose:

<bg-position>  = [
  [ center | left|right | top|bottom | <percentage>|<length> ]
|
  [ center | left|right | <percentage>|<length> ] 
  [ center | top|bottom | <percentage>|<length> ]
|
  [ [ left|right ] [ <percentage>|<length> ] [ center | top|bottom ] ]
|
  [ [ center | left|right ] [ top|bottom ] [ <percentage> | <length> ] ]
|
  [ [ left|right ] [ <percentage>|<length> ] [ top|bottom ] [ <percentage>|<length> ] ]
]

variant (by first token):

<bg-position>  = [
  [            [ left | right ]  [ <percentage> | <length> ]?
    [ center | [ top | bottom ]? [ <percentage> | <length> ]? ] ]
| 
  [ [ center                    |  <percentage> | <length> ]
    [ center | [ top | bottom ]? [ <percentage> | <length> ]? ] ]
|
  [            [ top | bottom ]  [ <percentage> | <length> ]?   ]
]

PS: Why again is the vertical center not called ‘middle’?
PPS: Procrastination sucks big time.

Received on Tuesday, 20 December 2011 14:07:22 UTC