"Dave" <[EMAIL PROTECTED]> wrote:
> So I'm trying to write a CSS preprocessor.

What you're trying to do is write a parser.  I don't know CSS, so I can't 
comment on the details, but basically, you're trying to parse a non-trivial 
language.  It is usually hopeless to try and write a parser using just 
pattern-matching.  You really need to read up on grammars and parsers to do 
this right.  Consider, for example, something like

#selector { /* } */ foo; }

getting that right is pretty tricky, and this is far from the most complex 
example possible.

I think you might want to start at 
http://python.miscellaneousmirror.org/topics/parsing.html, and do a bunch 
of reading about parsing theory, before you sit down to start writing code.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to