[Mapcss] Little syntax easement

Tom MacWright tom at macwright.org
Mon Feb 6 15:47:01 GMT 2012


> it makes parsing the language significantly harder

Could you be more specific there? I don't see much of a difference. In
fact, [ and ] are almost direct stand-ins for tag(' and ').

> makes it significantly less like CSS.

CSS, of course, has neither fields nor variables, so there's not much of a
corrolary in this space. The one 'variable' standard that Carto already
mocks is the @less style variables, but differentiating between fields and
variables is necessary to make comparisons between fields possible, like
#rule[ [field] = [otherfield] ].

On Mon, Feb 6, 2012 at 10:41 AM, Thomas Davie <tom.davie at gmail.com> wrote:

> I'm much less keen on this proposal – it makes parsing the language
> significantly harder, and makes it significantly less like CSS.
>
> I'm not completely sure yet, but I also suspect that there's ambiguities
> between specifying a list of specifiers, and eval syntax which would
> totally rule this out.
>
> Bob
>
> if (*ra4 != 0xffc78948) { return false; }
>
>
> On 6 Feb 2012, at 14:35, Paul Hartmann wrote:
>
> On 02/06/2012 10:27 AM, Richard Fairhurst wrote:
>
> Hi all,
>
>
> I'd like to suggest a little 'easement' to make MapCSS syntax less
>
> verbose in one particular case.
>
>
> Right now, if you want to use a tag value in a declaration, you need to
>
> fire up the eval parser:
>
>    way[highway] { width: eval("tag('lanes')"); }
>
>
> It'd be more pleasant, and more efficient, to allow this too:
>
>    way[highway] { width: tag('lanes'); }
>
>
> and it's quite CSS-like, because you can of course use a similar syntax
>
> in Real CSS:
>
>    way[highway] { color: rgb(0,0,0); }
>
>
> +1
>
> I'd go one or two steps further:
>
>  (1) Get rid of eval:
>
> width: eval("tag('lanes') * 5");
>
> would become
>
> width: tag('lanes') * 5;
>
>
>  (2) Interpret any keyword FOO in an expression as prop("FOO") unless
> it matches a build-in keyword. (This adds support for global constants.)
>
> way {
>  RESIDENTIAL_COLOR: #AAAAAA;
>  LANE_WIDTH: 3;
> }
> way[highway=residential] {
>  color: RESIDENTIAL_COLOR;
>  width: tag("lanes") * LANE_WIDTH;
> }
> way[highway=residential][oneway=yes] {
>  width: width - 2;
> }
>
> Paul
>
> _______________________________________________
> Mapcss mailing list
> Mapcss at openstreetmap.org
> http://lists.openstreetmap.org/listinfo/mapcss
>
>
>
> _______________________________________________
> Mapcss mailing list
> Mapcss at openstreetmap.org
> http://lists.openstreetmap.org/listinfo/mapcss
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/mapcss/attachments/20120206/5d514d44/attachment.html>


More information about the Mapcss mailing list