Problem with RGB value syntax
Wolfgang Rieger writes:
> There is a problem with the proposed syntax for RGB and RRGGBB values.
> Because both id-selector and RGB values are prefixed with '#', it is
> not possible to use Lex in a straightforward way to implement the
> lexical analyzer.
This is clearly a problem with lex, not with CSS. The selector appears
on the lhs and the rgb vales appear on the rhs; there is no ambiguity
in the syntax.
> Reason: '#f00' would be '#' followed by a legal identifier, but '#0f0'
> would be '#' and a number ('0') followed by an identifier ('f0').
Altering CSS to work around deficiencies of a particular code
generation tool does not seem desirable or necessary.
> Because of this conflict it would be necessary to make the lexical
> analyzer context-sensitive, i.e. '#' in the selector part of a rule
> and '#' in the declaration list would be handled different.
Yes. That seems a workable solution. Put it this way - how would you
react to further change requests to ease programming for (say) visual
basic, perl, awk, snobol ... the CSS syntax introduces no ambiguity
for the use of # to mean ID on the lhs and as an rgb color prefix (as
widely used by browsers) on the rhs.
If it ain't broke, don't fix it ;-)
Chris Lilley, W3C [ http://www.w3.org/ ]
email@example.com 2004 Rt des Lucioles / BP 93
+33 93 65 79 87 06902 Sophia Antipolis Cedex, France