[CSS21][Core grammar] Significant whitespace

Hi,

I am in the process of writing a "future proof" parser for CSS. The idea 
is to separate the core grammar from stuff defined in CSS 2.1 or various 
CSS 3 modules, so that it is easy to add syntax from such modules.

White space can appear at a lot of places in the core grammar, and some 
of it is significant. For example, the selector 'a [href]' has a 
descendant combinator and is different from 'a[href]'.

However, most white space is *not* significant and can be safely removed 
while parsing the core gramma. For example between statements or between 
declarations.

What about white space inside the value for a declaration? The 'value' 
field for any property that I can find never lists white space. But is 
there a design principle that I can rely on saying that white space in 
any property value will never be significant like it is in selectors? 
(Other than for separating tokens.)

If there is no such principle, white space needs to be handled while 
parsing the value for each individual property.

For example, there has been suggestions of accessing individual items in 
"lists" like font-family or transforms.
If a value like "font-family[4]" becomes legal, will it be the same as 
"font-family [4]" or will white space become significant?

Thanks,
-- 
Simon Sapin

Received on Tuesday, 21 February 2012 01:35:36 UTC