OsmSharp / ui

The UI components.
http://osmsharp.com/
GNU General Public License v2.0
139 stars 91 forks source link

MapCSS Lexer/Parser #286

Open charlenni opened 6 years ago

charlenni commented 6 years ago

First of all: Thank you for sharing your code. It helped me a lot.

I want to ask, how well tested your code for the lexer/parser of MapCSS is tested. I encounter problems when reading the Mapnik mapnik.mapcss (mapnik.zip) file. There are some rules, that aren't interpreted correct. I use the original Antlr 3.5.0.2, because your 3.5.0.3 implementation for PCL doesn't support my used profile (profile111). Perhaps this is the reason?

The following two entries result in an empty rule

way::* {
    linejoin: miter;
    linecap: none;
}

at line 14 and

*::* {
    text-halo-color: white;
    text-anchor-horizontal: center;
    text-anchor-vertical: center;
}

at line 23 I get an "A recognition error occurred" error with text "<unexpected: [@86,667:667='*',<55>,14:5], resync=way::*>". It seems, that the lexer(?) has problems with the "*" at the end.

The other problem is at line 363

way|z13-14[waterway=stream][!tunnel?]::water_lines-casing,
way|z13-14[waterway=ditch][!tunnel?]::water_lines-casing,
way|z13-14[waterway=drain][!tunnel?]::water_lines-casing {
    color: white;
    width: 1.5;
    z-index: -1;
}

where I get an "A recognition error occurred" error with text "<unexpected: [@2340,6758:6758='?',<124>,363:35], resync=way|z13-14[waterway=stream][!tunnel?]::water_lines-casing>". There seems to be a problem with the OP_TRUTHY operator "?" at "!tunnel?". At other places the OP_TRUTHY operator without the negotiation works.

I know, this part of your work is a little bit older ( ;) ), but I hope, you could give me a short answer, if this code worked without errors for you.

Thank you for any help.

Best regards Dirk

xivk commented 6 years ago

I know for sure that not the entire spectrum of mapcss is supported so it's possible some features are just not implemented.

I would suggest trying to figure out how to update the code with whatever you can find in the other implementations. You can have a look at what's used in JOSM (Java) for example but I think it also implements some kind of dialect of mapcss.