[Mapcss] Eval isn't really needed

Andrew O. Shadoura bugzilla at tut.by
Wed Jul 7 13:16:52 BST 2010


Hello.

I have some thoughts on eval(). 

First, if we use eval() as is, I think we should put its argument in quotes:

  height: eval("2*2");

or 

  height: eval('2*2');

and only skip them if the argument is numeric (or if it is hex-color):

  height: eval(2);

Moreover, I think we don't need eval as such, we can just drop it:

  height: 2*2;

This won't slow down parsers, as it's easy to check if rule contains eval, 
using this regexp:

^([a-z-]+)[ ]*:[ ]*("([^\x22]*)"|([0-9,.]+)|(#[,0-9a-fA-F]+)+)

(maybe need to add ''-style quotes here).

For compatibility reasons, we can have eval() being no-op function, so it 
becomes completely optional.

Ideas? Comments?

-- 
WBR, Andrew
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.openstreetmap.org/pipermail/mapcss/attachments/20100707/8a7b2a0c/attachment.pgp>


More information about the Mapcss mailing list