Support @supports {rule}
in mapcss
#2081
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds basic support for
@supports {}
blocks in mapcssIt doesn't really parse the
@supports
conditions, that would be:user-agent: josm
?Instead, it checks if there is a
-osmoseItemClassLevel
property present, and only if so, it assumes it's safe for Osmose. All other (possibly unsafe) rules are discarded.Note that the regeneration of mapcss didn't add new rules to transport.validator.mapcss because last time the rule that is now in
@supports
was already present; it was just not in a@supports
context. (See this old-new comparison)Note on the changes in the *.g4 file: the whitespace after the
SUPPORTS_NOT
must be present. If not, antlrs generated file will detect thenot
in i.e.*[not:name][name]["not:name"=*"name"],
fromplugins/notprefix.validator.mapcss
as such a SUPPORTS_NOT, failing to compile after that. (This also happens withset
, but as we don't have rules with*[set*
it doesn't cause issues). If you want to avoid this, we have to move these fixed string rules (SUPPORTS_NOT
,SUPPORTS_AND
,SUPPORTS_OR
, andSET
) to the end of the g4 file (although I didn't check yet if this causes other issues for set).See #2077