From 7326c0d5585d2ceaedd3d5fc0066214d128fbb87 Mon Sep 17 00:00:00 2001 From: artemp Date: Tue, 10 Jan 2017 11:54:08 +0100 Subject: [PATCH] expressions - simplify attribute parsing by combining feature attribute and geometry_type attribute processing. --- include/mapnik/expression_grammar_x3_def.hpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/include/mapnik/expression_grammar_x3_def.hpp b/include/mapnik/expression_grammar_x3_def.hpp index 6c25b4812..df89e877d 100644 --- a/include/mapnik/expression_grammar_x3_def.hpp +++ b/include/mapnik/expression_grammar_x3_def.hpp @@ -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(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]