expressions - simplify attribute parsing by combining feature attribute and geometry_type attribute processing.

This commit is contained in:
artemp 2017-01-10 11:54:08 +01:00
parent e5a93bce52
commit 7326c0d558

View file

@ -77,7 +77,15 @@ namespace mapnik { namespace grammar {
auto do_attribute = [] (auto const& ctx)
{
_val(ctx) = std::move(attribute(_attr(ctx)));
auto & attr = _attr(ctx);
if (attr == "mapnik::geometry_type")
{
_val(ctx) = std::move(geometry_type_attribute());
}
else
{
_val(ctx) = std::move(attribute(attr));
}
};
auto do_global_attribute = [] (auto const& ctx)
@ -85,11 +93,6 @@ namespace mapnik { namespace grammar {
_val(ctx) = std::move(global_attribute(_attr(ctx)));
};
auto do_geometry_type_attribute = [] (auto const& ctx)
{
_val(ctx) = std::move(geometry_type_attribute());
};
auto do_add = [] (auto const& ctx)
{
_val(ctx) = std::move(mapnik::binary_node<mapnik::tags::plus>(std::move(_val(ctx)), std::move(_attr(ctx))));
@ -387,8 +390,6 @@ namespace mapnik { namespace grammar {
|
quoted_string[do_unicode]
|
lit("[mapnik::geometry_type]")[do_geometry_type_attribute]
|
feature_attr[do_attribute]
|
global_attr[do_global_attribute]