Commit 99e9ce2a authored by Volker Krause's avatar Volker Krause
Browse files

Expand MapCSS grammar for supporting layer selectors

Not used in any way yet though.
parent d38034d8
Pipeline #65181 passed with stage
in 20 seconds
......@@ -121,3 +121,16 @@ node[shop=pastry]
node.importantShops { color: "red"; }
way.importantShops|z20- { color: "green"; }
*.importantShops[access=no] { color: "blue"; }
// layer selectors (see https://wiki.openstreetmap.org/wiki/MapCSS/0.2/Proposal_layer_selector)
way[highway]::road {
width: 8;
color: #ffffff;
casing-width: 2;
casing-color: #a0a0a0;
}
way[railway=tram]::tram {
width: 2;
color: #303030;
z-index: 1;
}
......@@ -142,3 +142,18 @@ way.importantShops|z20-
color: "blue";
}
way[highway]
{
width: 8;
color: #ffffffff;
casing-width: 2;
casing-color: #ffa0a0a0;
}
way[railway=tram]
{
width: 2;
color: #ff303030;
z-index: 1;
}
......@@ -119,6 +119,7 @@ using namespace KOSMIndoorMap;
%type <zoomRange> ZoomRange
%type <condition> Condition
%type <binaryOp> BinaryOp
%type <strRef> LayerSelector
%type <strRef> Key
%type <rule> Declarations
%type <declaration> Declaration
......@@ -189,14 +190,14 @@ Selector:
// TODO incomplete: missing pseudo-class
BasicSelector:
T_IDENT[I] ClassSelector[C] ZoomRange[Z] Tests[T] {
T_IDENT[I] ClassSelector[C] ZoomRange[Z] Tests[T] LayerSelector[L] {
$$ = new MapCSSBasicSelector;
$$->setClass($C.str, $C.len);
$$->setObjectType($I.str, $I.len);
$$->setZoomRange($Z.low, $Z.high);
$$->setConditions($T);
}
| T_STAR ClassSelector[C] ZoomRange[Z] Tests[T] {
| T_STAR ClassSelector[C] ZoomRange[Z] Tests[T] LayerSelector[L] {
$$ = new MapCSSBasicSelector;
$$->objectType = MapCSSBasicSelector::Any;
$$->setClass($C.str, $C.len);
......@@ -236,6 +237,11 @@ BinaryOp:
T_BINARY_OP { $$ = $1; }
| T_EQUALS { $$ = MapCSSCondition::Equal; }
LayerSelector:
%empty { $$.str = nullptr; $$.len = 0; }
| T_COLON T_COLON T_IDENT[L] { $$ = $L; }
;
Key:
T_IDENT { $$ = $1; }
| Key T_COLON T_IDENT { $$.str = $1.str; $$.len = $3.str - $1.str + $3.len; }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment