From c191e196c0793ce6ba508a825c50ec7b0a2b8fd3 Mon Sep 17 00:00:00 2001 From: Nikita Kniazev Date: Mon, 1 Jul 2019 20:38:11 +0300 Subject: [PATCH] Replace MAPNIK_INIT_PRIORITY workaround Spirit rules are just placeholders. They are cheap to construct and by doing this static initialization order fiasco problem is effectively avoided. Also had to fix name clash between geojson and generic json parsers. --- include/mapnik/css_color_grammar_x3.hpp | 9 ++--- include/mapnik/css_color_grammar_x3_def.hpp | 8 ----- include/mapnik/csv/csv_grammar_x3.hpp | 2 ++ include/mapnik/csv/csv_grammar_x3_def.hpp | 8 ----- include/mapnik/expression_grammar_x3.hpp | 9 ++--- include/mapnik/expression_grammar_x3_def.hpp | 11 +----- include/mapnik/image_filter_grammar_x3.hpp | 9 ++--- .../mapnik/image_filter_grammar_x3_def.hpp | 10 +----- include/mapnik/init_priority.hpp | 34 ------------------- include/mapnik/json/feature_grammar_x3.hpp | 11 +++--- .../mapnik/json/feature_grammar_x3_def.hpp | 10 ++---- .../mapnik/json/generic_json_grammar_x3.hpp | 10 +++--- .../json/generic_json_grammar_x3_def.hpp | 7 +--- include/mapnik/json/geojson_grammar_x3.hpp | 12 +++---- .../mapnik/json/geojson_grammar_x3_def.hpp | 26 ++++++-------- include/mapnik/json/positions_grammar_x3.hpp | 8 ++--- .../mapnik/json/positions_grammar_x3_def.hpp | 3 -- include/mapnik/json/topojson_grammar_x3.hpp | 8 ++--- .../mapnik/json/topojson_grammar_x3_def.hpp | 7 ++-- .../mapnik/json/unicode_string_grammar_x3.hpp | 8 ++--- .../json/unicode_string_grammar_x3_def.hpp | 3 -- include/mapnik/path_expression_grammar_x3.hpp | 8 ++--- .../mapnik/path_expression_grammar_x3_def.hpp | 11 ------ include/mapnik/svg/svg_path_grammar_x3.hpp | 11 +++--- .../mapnik/svg/svg_path_grammar_x3_def.hpp | 18 +--------- .../mapnik/svg/svg_transform_grammar_x3.hpp | 8 ++--- .../svg/svg_transform_grammar_x3_def.hpp | 12 +------ .../transform_expression_grammar_x3.hpp | 7 ++-- .../transform_expression_grammar_x3_def.hpp | 12 +------ include/mapnik/wkt/wkt_grammar_x3.hpp | 7 ++-- include/mapnik/wkt/wkt_grammar_x3_def.hpp | 10 ------ plugins/input/csv/csv_utils.cpp | 2 +- .../input/topojson/topojson_datasource.cpp | 2 +- src/color_factory.cpp | 2 +- src/expression.cpp | 4 +-- src/json/extract_bounding_boxes_x3.cpp | 5 ++- src/json/feature_grammar_x3.cpp | 14 +------- src/json/generic_json_grammar_x3.cpp | 13 +------ src/json/geojson_grammar_x3.cpp | 16 ++------- src/json/geometry_from_geojson.cpp | 2 +- src/json/parse_feature.cpp | 6 ++-- src/json/positions_grammar_x3.cpp | 9 +---- src/json/topojson_grammar_x3.cpp | 9 +---- src/json/unicode_string_grammar_x3.cpp | 8 +---- src/parse_image_filters.cpp | 2 +- src/parse_path.cpp | 2 +- src/parse_transform.cpp | 4 +-- src/svg/svg_path_parser.cpp | 4 +-- src/svg/svg_points_parser.cpp | 4 +-- src/svg/svg_transform_parser.cpp | 4 +-- src/wkt/wkt_factory.cpp | 2 +- test/unit/color/css_color.cpp | 2 +- test/unit/datasource/topojson.cpp | 2 +- .../mapnik-index/process_geojson_file_x3.cpp | 2 +- 54 files changed, 98 insertions(+), 339 deletions(-) delete mode 100644 include/mapnik/init_priority.hpp diff --git a/include/mapnik/css_color_grammar_x3.hpp b/include/mapnik/css_color_grammar_x3.hpp index 96b4294be..9e24fc55b 100644 --- a/include/mapnik/css_color_grammar_x3.hpp +++ b/include/mapnik/css_color_grammar_x3.hpp @@ -41,15 +41,10 @@ namespace css_color_grammar struct css_color_class; using css_color_grammar_type = x3::rule; +css_color_grammar_type const css_color = "css_color"; + BOOST_SPIRIT_DECLARE(css_color_grammar_type); }} - -namespace mapnik -{ -css_color_grammar::css_color_grammar_type const& color_grammar(); -} - - #endif // MAPNIK_CSS_COLOR_GRAMMAR_X3_HPP diff --git a/include/mapnik/css_color_grammar_x3_def.hpp b/include/mapnik/css_color_grammar_x3_def.hpp index 643cbbc3a..7f32d0219 100644 --- a/include/mapnik/css_color_grammar_x3_def.hpp +++ b/include/mapnik/css_color_grammar_x3_def.hpp @@ -220,8 +220,6 @@ x3::uint_parser hex2; x3::uint_parser hex1; x3::uint_parser dec3; -// starting rule -css_color_grammar_type const css_color("css_color"); // rules x3::rule const hex2_color("hex2_color"); x3::rule const hex1_color("hex1_color"); @@ -443,12 +441,6 @@ BOOST_SPIRIT_DEFINE( #pragma GCC diagnostic pop } // ns - -css_color_grammar::css_color_grammar_type const& color_grammar() -{ - return css_color_grammar::css_color; -} - } //ns mapnik #endif //MAPNIK_CSS_COLOR_GRAMMAR_X3_DEF_HPP diff --git a/include/mapnik/csv/csv_grammar_x3.hpp b/include/mapnik/csv/csv_grammar_x3.hpp index 5de18b1ae..a7ff34c31 100644 --- a/include/mapnik/csv/csv_grammar_x3.hpp +++ b/include/mapnik/csv/csv_grammar_x3.hpp @@ -60,6 +60,8 @@ struct quote_tag; struct csv_line_class; using csv_line_grammar_type = x3::rule; +csv_line_grammar_type const line = "csv-line"; + BOOST_SPIRIT_DECLARE(csv_line_grammar_type); }} diff --git a/include/mapnik/csv/csv_grammar_x3_def.hpp b/include/mapnik/csv/csv_grammar_x3_def.hpp index 792175e96..0cfebc285 100644 --- a/include/mapnik/csv/csv_grammar_x3_def.hpp +++ b/include/mapnik/csv/csv_grammar_x3_def.hpp @@ -81,8 +81,6 @@ struct literal : x3::parser> auto static const separator = literal{}; auto static const quote = literal{}; -// starting rule -csv_line_grammar_type const line("csv-line"); // rules x3::rule column("csv-column"); x3::rule text("csv-text"); @@ -108,12 +106,6 @@ BOOST_SPIRIT_DEFINE ( ); } // grammar - -grammar::csv_line_grammar_type const& csv_line_grammar() -{ - return grammar::line; -} - } // namespace mapnik diff --git a/include/mapnik/expression_grammar_x3.hpp b/include/mapnik/expression_grammar_x3.hpp index ffc487645..5bdd72ae3 100644 --- a/include/mapnik/expression_grammar_x3.hpp +++ b/include/mapnik/expression_grammar_x3.hpp @@ -44,15 +44,10 @@ struct transcoder_tag; struct expression_class; // top-most ID using expression_grammar_type = x3::rule; +expression_grammar_type const expression("expression"); + BOOST_SPIRIT_DECLARE(expression_grammar_type); }} - -namespace mapnik -{ -grammar::expression_grammar_type const& expression_grammar(); -} - - #endif // MAPNIK_EXPRESSIONS_GRAMMAR_X3_HPP diff --git a/include/mapnik/expression_grammar_x3_def.hpp b/include/mapnik/expression_grammar_x3_def.hpp index 2d9437c62..5b889b927 100644 --- a/include/mapnik/expression_grammar_x3_def.hpp +++ b/include/mapnik/expression_grammar_x3_def.hpp @@ -300,8 +300,7 @@ namespace mapnik { namespace grammar { ; } } unesc_char; - // starting rule - expression_grammar_type const expression("expression"); + // rules x3::rule const logical_expression("logical expression"); x3::rule const not_expression("not expression"); @@ -451,12 +450,4 @@ namespace mapnik { namespace grammar { }} -namespace mapnik -{ -grammar::expression_grammar_type const& expression_grammar() -{ - return grammar::expression; -} -} - #endif // MAPNIK_EXPRESSIONS_GRAMMAR_X3_DEF_HPP diff --git a/include/mapnik/image_filter_grammar_x3.hpp b/include/mapnik/image_filter_grammar_x3.hpp index 40c0243a2..25f386d00 100644 --- a/include/mapnik/image_filter_grammar_x3.hpp +++ b/include/mapnik/image_filter_grammar_x3.hpp @@ -41,15 +41,10 @@ namespace image_filter struct image_filter_class; using image_filter_grammar_type = x3::rule >; -BOOST_SPIRIT_DECLARE(image_filter_grammar_type); +image_filter_grammar_type const start = "start"; +BOOST_SPIRIT_DECLARE(image_filter_grammar_type); }} -namespace mapnik { - -image_filter::image_filter_grammar_type const& image_filter_grammar(); - -} - #endif // MAPNIK_IMAGE_FILTER_GRAMMAR_X3_HPP diff --git a/include/mapnik/image_filter_grammar_x3_def.hpp b/include/mapnik/image_filter_grammar_x3_def.hpp index abb52a828..64af7e5cc 100644 --- a/include/mapnik/image_filter_grammar_x3_def.hpp +++ b/include/mapnik/image_filter_grammar_x3_def.hpp @@ -108,10 +108,8 @@ auto percent = [](auto & ctx) x3::uint_parser radius; // Import the expression rule -namespace { auto const& css_color = color_grammar(); } +namespace { using css_color_grammar::css_color; } -// starting rule -image_filter_grammar_type const start("start"); // rules x3::rule const filter("filter"); @@ -250,12 +248,6 @@ BOOST_SPIRIT_DEFINE( #pragma GCC diagnostic pop } // image_filter - -image_filter::image_filter_grammar_type const& image_filter_grammar() -{ - return image_filter::start; -} - } //ns mapnik #endif //MAPNIK_IMAGE_FILTER_GRAMMAR_X3_DEF_HPP diff --git a/include/mapnik/init_priority.hpp b/include/mapnik/init_priority.hpp deleted file mode 100644 index e75be4233..000000000 --- a/include/mapnik/init_priority.hpp +++ /dev/null @@ -1,34 +0,0 @@ -/***************************************************************************** - * - * This file is part of Mapnik (c++ mapping toolkit) - * - * Copyright (C) 2017 Artem Pavlenko - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - *****************************************************************************/ - -#ifndef MAPNIK_INIT_PRIORITY_HPP -#define MAPNIK_INIT_PRIORITY_HPP - -// helper macro for dealing with static variables initialising order fiasco (#3821) -#if defined(__GNUC__) || defined(__clang__) -#define MAPNIK_INIT_PRIORITY(priority) __attribute__((init_priority(priority))) -#else -#define MAPNIK_INIT_PRIORITY -// TODO: anything we can do on windows? -#endif - -#endif //MAPNIK_INIT_PRIORITY_HPP diff --git a/include/mapnik/json/feature_grammar_x3.hpp b/include/mapnik/json/feature_grammar_x3.hpp index f26923442..2a7b6ac1c 100644 --- a/include/mapnik/json/feature_grammar_x3.hpp +++ b/include/mapnik/json/feature_grammar_x3.hpp @@ -36,15 +36,12 @@ namespace x3 = boost::spirit::x3; using feature_grammar_type = x3::rule; using geometry_grammar_type = x3::rule >; +feature_grammar_type const feature_rule = "Feature Rule"; +geometry_grammar_type const geometry_rule = "Geometry Rule"; + BOOST_SPIRIT_DECLARE(feature_grammar_type); BOOST_SPIRIT_DECLARE(geometry_grammar_type); -} - -grammar::feature_grammar_type const& feature_grammar(); -grammar::geometry_grammar_type const& geometry_grammar(); - - -}} +}}} #endif // MAPNIK_JSON_FEATURE_GRAMMAR_X3_HPP diff --git a/include/mapnik/json/feature_grammar_x3_def.hpp b/include/mapnik/json/feature_grammar_x3_def.hpp index 310d74048..6e031eddf 100644 --- a/include/mapnik/json/feature_grammar_x3_def.hpp +++ b/include/mapnik/json/feature_grammar_x3_def.hpp @@ -141,11 +141,9 @@ using x3::char_; namespace { // import unicode string rule -auto const& geojson_string = unicode_string_grammar(); +auto const& geojson_string = unicode_string; // import positions rule -auto const& positions_rule = positions_grammar(); -// import generic rule -auto const& value = generic_json_grammar(); +auto const& positions_rule = positions; } // geometry types symbols @@ -234,10 +232,6 @@ auto assign_property = [](auto const& ctx) }; -//exported rules -feature_grammar_type const feature_rule = "Feature Rule"; -geometry_grammar_type const geometry_rule = "Geometry Rule"; - // rules x3::rule const feature_type = "Feature Type"; x3::rule const geometry_type = "Geometry Type"; diff --git a/include/mapnik/json/generic_json_grammar_x3.hpp b/include/mapnik/json/generic_json_grammar_x3.hpp index 802db8459..dec94a3bf 100644 --- a/include/mapnik/json/generic_json_grammar_x3.hpp +++ b/include/mapnik/json/generic_json_grammar_x3.hpp @@ -39,13 +39,13 @@ namespace grammar { using generic_json_grammar_type = x3::rule; using generic_json_key_value_type = x3::rule; + +generic_json_grammar_type const value = "JSON Value"; +generic_json_key_value_type const key_value = "JSON Object element"; + BOOST_SPIRIT_DECLARE(generic_json_grammar_type); BOOST_SPIRIT_DECLARE(generic_json_key_value_type); -} -grammar::generic_json_grammar_type const& generic_json_grammar(); -grammar::generic_json_key_value_type const& generic_json_key_value(); - -}} +}}} #endif // MAPNIK_JSON_GENERIC_JSON_GRAMMAR_X3_HPP diff --git a/include/mapnik/json/generic_json_grammar_x3_def.hpp b/include/mapnik/json/generic_json_grammar_x3_def.hpp index ea4f52f3c..dff39273a 100644 --- a/include/mapnik/json/generic_json_grammar_x3_def.hpp +++ b/include/mapnik/json/generic_json_grammar_x3_def.hpp @@ -26,7 +26,6 @@ #include #include #include -#include namespace mapnik { namespace json { namespace grammar { @@ -70,12 +69,8 @@ using x3::lit; using x3::string; // import unicode string rule -namespace { auto const& json_string = mapnik::json::unicode_string_grammar(); } +namespace { auto const& json_string = mapnik::json::grammar::unicode_string; } -// exported rules -// start -generic_json_grammar_type const value MAPNIK_INIT_PRIORITY(102) ("JSON Value"); -generic_json_key_value_type const key_value("JSON Object element"); // rules x3::rule const object("JSON Object"); x3::rule const array("JSON Array"); diff --git a/include/mapnik/json/geojson_grammar_x3.hpp b/include/mapnik/json/geojson_grammar_x3.hpp index 4ef3e1c31..9a9ffaad8 100644 --- a/include/mapnik/json/geojson_grammar_x3.hpp +++ b/include/mapnik/json/geojson_grammar_x3.hpp @@ -71,13 +71,13 @@ struct geojson_value : geojson_value_base namespace grammar { using geojson_grammar_type = x3::rule; -using key_value_type = x3::rule; -BOOST_SPIRIT_DECLARE(geojson_grammar_type, key_value_type); -} +using geojson_key_value_type = x3::rule; -grammar::geojson_grammar_type const& geojson_grammar(); -grammar::key_value_type const& key_value_grammar(); +geojson_grammar_type const geojson_value = "GeoJSON Value"; +geojson_key_value_type const geojson_key_value = "GeoJSON Key/Value Type"; -}} +BOOST_SPIRIT_DECLARE(geojson_grammar_type, geojson_key_value_type); + +}}} #endif // MAPNIK_JSON_GEOJSON_GRAMMAR_X3_HPP diff --git a/include/mapnik/json/geojson_grammar_x3_def.hpp b/include/mapnik/json/geojson_grammar_x3_def.hpp index f5f52d5e6..00a1aff10 100644 --- a/include/mapnik/json/geojson_grammar_x3_def.hpp +++ b/include/mapnik/json/geojson_grammar_x3_def.hpp @@ -26,7 +26,6 @@ #include #include #include -#include #include @@ -88,40 +87,35 @@ struct geometry_type_ : x3::symbols } } geometry_type_sym; -// exported rules -// start -geojson_grammar_type const value MAPNIK_INIT_PRIORITY(106) ("JSON Value"); -key_value_type const key_value MAPNIK_INIT_PRIORITY(107) ("JSON key/value"); // rules x3::rule const object("JSON Object"); x3::rule const array("JSON Array"); -x3::rule const number("JSON Number"); -//x3::rule key_value("JSON key/value"); +x3::rule const number("JSON Number"); +x3::rule key_value("JSON key/value"); // GeoJSON x3::rule const coordinates("GeoJSON Coordinates"); x3::rule const geometry_type("GeoJSON Geometry Type"); -x3::rule const geojson_key_value("GeoJSON Key/Value Type"); auto const geojson_double = x3::real_parser>(); auto const geojson_integer = x3::int_parser(); // import unicode string rule -namespace { auto const& geojson_string = mapnik::json::unicode_string_grammar(); } +namespace { auto const& geojson_string = unicode_string; } // import positions rule -namespace { auto const& positions_rule = mapnik::json::positions_grammar(); } +namespace { auto const& positions_rule = positions; } // GeoJSON types -auto const value_def = object | array | geojson_string | number +auto const geojson_value_def = object | array | geojson_string | number ; auto const coordinates_def = lexeme[lit('"') >> (string("coordinates") > lit('"'))][assign_key] - > lit(':') > (positions_rule[assign_value] | value[assign_value]) + > lit(':') > (positions_rule[assign_value] | geojson_value[assign_value]) ; auto const geometry_type_def = lexeme[lit('"') >> (string("type") > lit('"'))][assign_key] - > lit(':') > (geometry_type_sym[assign_value] | value[assign_value]) + > lit(':') > (geometry_type_sym[assign_value] | geojson_value[assign_value]) ; -auto const key_value_def = geojson_string[assign_key] > lit(':') > value[assign_value] +auto const key_value_def = geojson_string[assign_key] > lit(':') > geojson_value[assign_value] ; auto const geojson_key_value_def = @@ -138,7 +132,7 @@ auto const object_def = lit('{') ; auto const array_def = lit('[') - > -(value % lit(',')) + > -(geojson_value % lit(',')) > lit(']') ; @@ -153,7 +147,7 @@ auto const number_def = geojson_double[assign] #include BOOST_SPIRIT_DEFINE( - value, + geojson_value, geometry_type, coordinates, object, diff --git a/include/mapnik/json/positions_grammar_x3.hpp b/include/mapnik/json/positions_grammar_x3.hpp index da2c37de5..8bdb09af7 100644 --- a/include/mapnik/json/positions_grammar_x3.hpp +++ b/include/mapnik/json/positions_grammar_x3.hpp @@ -39,12 +39,10 @@ namespace grammar { namespace x3 = boost::spirit::x3; using positions_grammar_type = x3::rule; +positions_grammar_type const positions = "Positions"; + BOOST_SPIRIT_DECLARE(positions_grammar_type); -} - -grammar::positions_grammar_type const& positions_grammar(); - -}} +}}} #endif // MAPNIK_JSON_POSITIONS_GRAMMAR_X3_HPP diff --git a/include/mapnik/json/positions_grammar_x3_def.hpp b/include/mapnik/json/positions_grammar_x3_def.hpp index 206d22251..1f90e0c70 100644 --- a/include/mapnik/json/positions_grammar_x3_def.hpp +++ b/include/mapnik/json/positions_grammar_x3_def.hpp @@ -25,7 +25,6 @@ #include #include -#include namespace mapnik { namespace json { namespace grammar { @@ -42,8 +41,6 @@ auto assign_helper = [](auto const& ctx) }; } // anonymous ns -// start rule -positions_grammar_type const positions MAPNIK_INIT_PRIORITY(103) ("Positions"); // rules x3::rule const point("Position"); x3::rule const ring("Ring"); diff --git a/include/mapnik/json/topojson_grammar_x3.hpp b/include/mapnik/json/topojson_grammar_x3.hpp index 8965f79db..f11ea3112 100644 --- a/include/mapnik/json/topojson_grammar_x3.hpp +++ b/include/mapnik/json/topojson_grammar_x3.hpp @@ -37,12 +37,10 @@ namespace x3 = boost::spirit::x3; using topojson_grammar_type = x3::rule; +topojson_grammar_type const topology = "Topology"; + BOOST_SPIRIT_DECLARE(topojson_grammar_type); -} - -grammar::topojson_grammar_type const& topojson_grammar(); - -}} +}}} #endif //MAPNIK_TOPOJSON_GRAMMAR_X3_HPP diff --git a/include/mapnik/json/topojson_grammar_x3_def.hpp b/include/mapnik/json/topojson_grammar_x3_def.hpp index c7946447d..8386a09b3 100644 --- a/include/mapnik/json/topojson_grammar_x3_def.hpp +++ b/include/mapnik/json/topojson_grammar_x3_def.hpp @@ -26,7 +26,6 @@ #include #include #include -#include #pragma GCC diagnostic push #include @@ -280,9 +279,9 @@ using x3::omit; namespace { // import unicode string rule -auto const& json_string = json::unicode_string_grammar(); +auto const& json_string = json::grammar::unicode_string; // json value -auto const& json_value = json::generic_json_grammar(); +auto const& json_value = json::grammar::value; } using coordinates_type = util::variant>; @@ -305,8 +304,6 @@ struct topojson_geometry_type_ : x3::symbols } } topojson_geometry_type; -// start rule -topojson_grammar_type const topology MAPNIK_INIT_PRIORITY(104) ("Topology"); // rules x3::rule const transform = "Transform"; x3::rule const bbox = "Bounding Box"; diff --git a/include/mapnik/json/unicode_string_grammar_x3.hpp b/include/mapnik/json/unicode_string_grammar_x3.hpp index 9cc9f3f34..d710432b2 100644 --- a/include/mapnik/json/unicode_string_grammar_x3.hpp +++ b/include/mapnik/json/unicode_string_grammar_x3.hpp @@ -34,12 +34,10 @@ namespace mapnik { namespace json { namespace grammar { namespace x3 = boost::spirit::x3; using unicode_string_grammar_type = x3::rule; +unicode_string_grammar_type const unicode_string = "Unicode String"; + BOOST_SPIRIT_DECLARE(unicode_string_grammar_type); -} - -grammar::unicode_string_grammar_type const& unicode_string_grammar(); - -}} +}}} #endif // MAPNIK_JSON_UNICODE_STRING_GRAMMAR_X3_HPP diff --git a/include/mapnik/json/unicode_string_grammar_x3_def.hpp b/include/mapnik/json/unicode_string_grammar_x3_def.hpp index 8f7d0e765..60e2d44d5 100644 --- a/include/mapnik/json/unicode_string_grammar_x3_def.hpp +++ b/include/mapnik/json/unicode_string_grammar_x3_def.hpp @@ -24,7 +24,6 @@ #define MAPNIK_JSON_UNICODE_STRING_GRAMMAR_X3_DEF_HPP #include -#include // boost #include // @@ -109,8 +108,6 @@ x3::uint_parser const hex2 {}; x3::uint_parser const hex4 {}; x3::uint_parser const hex8 {}; -// start rule -unicode_string_grammar_type const unicode_string MAPNIK_INIT_PRIORITY(101) ("Unicode String"); // rules x3::rule const double_quoted("Double-quoted string"); x3::rule const escaped("Escaped Character"); diff --git a/include/mapnik/path_expression_grammar_x3.hpp b/include/mapnik/path_expression_grammar_x3.hpp index 7b694bcc6..aa41564fa 100644 --- a/include/mapnik/path_expression_grammar_x3.hpp +++ b/include/mapnik/path_expression_grammar_x3.hpp @@ -37,12 +37,10 @@ namespace x3 = boost::spirit::x3; struct path_expression_class; // top-most ID using path_expression_grammar_type = x3::rule; +path_expression_grammar_type const path_expression = "path_expression"; + BOOST_SPIRIT_DECLARE(path_expression_grammar_type); -} - -grammar::path_expression_grammar_type const& path_expression_grammar(); - -} +}} #endif // MAPNIK_PATH_EXPRESSIONS_GRAMMAR_X3_HPP diff --git a/include/mapnik/path_expression_grammar_x3_def.hpp b/include/mapnik/path_expression_grammar_x3_def.hpp index 978d0e13f..7b906ba19 100644 --- a/include/mapnik/path_expression_grammar_x3_def.hpp +++ b/include/mapnik/path_expression_grammar_x3_def.hpp @@ -33,8 +33,6 @@ using x3::standard_wide::char_; using x3::lexeme; auto create_string = [](auto & ctx) { _val(ctx).push_back(_attr(ctx)); }; auto create_attribute = [](auto & ctx) { _val(ctx).push_back(mapnik::attribute(_attr(ctx))); }; -// top-most rule -path_expression_grammar_type const path_expression("path_expression"); // rules x3::rule const attr_expression("attribute"); x3::rule const str_expression("string"); @@ -51,13 +49,4 @@ BOOST_SPIRIT_DEFINE( }} -namespace mapnik { - -grammar::path_expression_grammar_type const& path_expression_grammar() -{ - return grammar::path_expression; -} - -} - #endif //MAPNIK_PATH_EXPRESSIONS_GRAMMAR_X3_DEF_HPP diff --git a/include/mapnik/svg/svg_path_grammar_x3.hpp b/include/mapnik/svg/svg_path_grammar_x3.hpp index 82cfe01e5..f7b84801f 100644 --- a/include/mapnik/svg/svg_path_grammar_x3.hpp +++ b/include/mapnik/svg/svg_path_grammar_x3.hpp @@ -32,15 +32,12 @@ namespace x3 = boost::spirit::x3; using svg_path_grammar_type = x3::rule; using svg_points_grammar_type = x3::rule; +svg_path_grammar_type const svg_path = "SVG Path"; +svg_points_grammar_type const svg_points = "SVG_Points"; + BOOST_SPIRIT_DECLARE(svg_path_grammar_type, svg_points_grammar_type); -} - -grammar::svg_path_grammar_type const& svg_path_grammar(); - -grammar::svg_points_grammar_type const& svg_points_grammar(); - -}} +}}} #endif // MAPNIK_SVG_PATH_GRAMMAR_X3_HPP diff --git a/include/mapnik/svg/svg_path_grammar_x3_def.hpp b/include/mapnik/svg/svg_path_grammar_x3_def.hpp index c11195748..04a29960e 100644 --- a/include/mapnik/svg/svg_path_grammar_x3_def.hpp +++ b/include/mapnik/svg/svg_path_grammar_x3_def.hpp @@ -146,10 +146,6 @@ auto const absolute = [] (auto const& ctx) extract_relative(ctx) = false; }; -// exported rules -svg_path_grammar_type const svg_path = "SVG Path"; -svg_points_grammar_type const svg_points = "SVG_Points"; - // rules auto const coord = x3::rule{} = double_ > -lit(',') > double_; @@ -200,18 +196,6 @@ BOOST_SPIRIT_DEFINE( ); #pragma GCC diagnostic pop -} - -grammar::svg_path_grammar_type const& svg_path_grammar() -{ - return grammar::svg_path; -} - -grammar::svg_points_grammar_type const& svg_points_grammar() -{ - return grammar::svg_points; -} - -}} +}}} #endif // MAPNIK_SVG_PATH_GRAMMAR_X3_HPP diff --git a/include/mapnik/svg/svg_transform_grammar_x3.hpp b/include/mapnik/svg/svg_transform_grammar_x3.hpp index 2ecd3eb13..64764bed8 100644 --- a/include/mapnik/svg/svg_transform_grammar_x3.hpp +++ b/include/mapnik/svg/svg_transform_grammar_x3.hpp @@ -32,12 +32,10 @@ using namespace boost::spirit::x3; using svg_transform_grammar_type = x3::rule; +svg_transform_grammar_type const svg_transform = "SVG Transform"; + BOOST_SPIRIT_DECLARE(svg_transform_grammar_type); -} - -grammar::svg_transform_grammar_type const& svg_transform_grammar(); - -}} +}}} #endif // MAPNIK_SVG_TRANSFORM_GRAMMAR_X3_HPP diff --git a/include/mapnik/svg/svg_transform_grammar_x3_def.hpp b/include/mapnik/svg/svg_transform_grammar_x3_def.hpp index e1ff3849f..5d34a8b44 100644 --- a/include/mapnik/svg/svg_transform_grammar_x3_def.hpp +++ b/include/mapnik/svg/svg_transform_grammar_x3_def.hpp @@ -118,8 +118,6 @@ auto const skewY_action = [] (auto const& ctx) tr = agg::trans_affine_skewing(0.0, agg::deg2rad(skew_y)) * tr; }; -//exported rule -svg_transform_grammar_type const svg_transform = "SVG Transform"; // rules auto const matrix = x3::rule {} = no_case[lit("matrix")] > lit('(') > (double_ > -lit(',') @@ -157,14 +155,6 @@ BOOST_SPIRIT_DEFINE( ); #pragma GCC diagnostic pop -} - -grammar::svg_transform_grammar_type const& svg_transform_grammar() -{ - return grammar::svg_transform; -} - -}} - +}}} #endif // MAPNIK_SVG_TRANSFORM_GRAMMAR_X3_HPP diff --git a/include/mapnik/transform/transform_expression_grammar_x3.hpp b/include/mapnik/transform/transform_expression_grammar_x3.hpp index 2c3e40b75..3feb2a256 100644 --- a/include/mapnik/transform/transform_expression_grammar_x3.hpp +++ b/include/mapnik/transform/transform_expression_grammar_x3.hpp @@ -39,13 +39,10 @@ namespace grammar { struct transform_expression_class; // top-most ID using transform_expression_grammar_type = x3::rule; +transform_expression_grammar_type const transform("transform"); + BOOST_SPIRIT_DECLARE(transform_expression_grammar_type); }} // ns -namespace mapnik -{ -grammar::transform_expression_grammar_type const& transform_expression_grammar(); -} - #endif diff --git a/include/mapnik/transform/transform_expression_grammar_x3_def.hpp b/include/mapnik/transform/transform_expression_grammar_x3_def.hpp index 18a3544f5..e7f2f1f6c 100644 --- a/include/mapnik/transform/transform_expression_grammar_x3_def.hpp +++ b/include/mapnik/transform/transform_expression_grammar_x3_def.hpp @@ -127,8 +127,6 @@ auto const construct_rotate = [](auto const& ctx) _val(ctx) = mapnik::rotate_node(a, sx, sy); }; -// starting rule -transform_expression_grammar_type const transform("transform"); // rules x3::rule transform_list_rule("transform list"); x3::rule transform_node_rule("transform node"); @@ -155,7 +153,7 @@ auto const atom = x3::rule {} = double_[create_expr_n auto const sep_atom = x3::rule {} = -lit(',') >> double_[create_expr_node] ; -auto const expr_def = expression_grammar(); +auto const expr_def = expression; // Individual arguments in lists containing one or more compound // expressions are separated by a comma. auto const sep_expr_def = lit(',') > expr @@ -212,12 +210,4 @@ BOOST_SPIRIT_DEFINE ( }} // ns -namespace mapnik -{ -grammar::transform_expression_grammar_type const& transform_expression_grammar() -{ - return grammar::transform; -} -} - #endif diff --git a/include/mapnik/wkt/wkt_grammar_x3.hpp b/include/mapnik/wkt/wkt_grammar_x3.hpp index 9780fb9d6..275cc19b6 100644 --- a/include/mapnik/wkt/wkt_grammar_x3.hpp +++ b/include/mapnik/wkt/wkt_grammar_x3.hpp @@ -36,14 +36,11 @@ namespace x3 = boost::spirit::x3; struct wkt_class; // top-most ID using wkt_grammar_type = x3::rule>; +wkt_grammar_type const wkt("wkt"); + BOOST_SPIRIT_DECLARE(wkt_grammar_type); }} -namespace mapnik -{ -grammar::wkt_grammar_type const& wkt_grammar(); -} - #endif // MAPNIK_WKT_GRAMMAR_X3_HPP diff --git a/include/mapnik/wkt/wkt_grammar_x3_def.hpp b/include/mapnik/wkt/wkt_grammar_x3_def.hpp index 56855a43d..9d08562eb 100644 --- a/include/mapnik/wkt/wkt_grammar_x3_def.hpp +++ b/include/mapnik/wkt/wkt_grammar_x3_def.hpp @@ -57,8 +57,6 @@ auto add_ring = [](auto const& ctx) _val(ctx).push_back(std::move(ring)); }; -// start rule -wkt_grammar_type const wkt("wkt"); // rules x3::rule const empty("EMPTY"); x3::rule > const point("POINT"); @@ -126,12 +124,4 @@ BOOST_SPIRIT_DEFINE( ); }} -namespace mapnik -{ -grammar::wkt_grammar_type const& wkt_grammar() -{ - return grammar::wkt; -} -} - #endif // MAPNIK_WKT_GRAMMAR_X3_DEF_HPP diff --git a/plugins/input/csv/csv_utils.cpp b/plugins/input/csv/csv_utils.cpp index b48b184d5..3da5e51a3 100644 --- a/plugins/input/csv/csv_utils.cpp +++ b/plugins/input/csv/csv_utils.cpp @@ -197,7 +197,7 @@ mapnik::csv_line parse_line(char const* start, char const* end, char separator, namespace x3 = boost::spirit::x3; auto parser = x3::with(quote) [ x3::with(separator) - [ mapnik::csv_line_grammar()] + [ mapnik::grammar::line ] ]; mapnik::csv_line values; diff --git a/plugins/input/topojson/topojson_datasource.cpp b/plugins/input/topojson/topojson_datasource.cpp index 4b8361ae3..9f688707c 100644 --- a/plugins/input/topojson/topojson_datasource.cpp +++ b/plugins/input/topojson/topojson_datasource.cpp @@ -184,7 +184,7 @@ void topojson_datasource::parse_topojson(T const& buffer) using space_type = boost::spirit::x3::standard::space_type; try { - boost::spirit::x3::phrase_parse(itr, end, mapnik::json::topojson_grammar(), space_type(), topo_); + boost::spirit::x3::phrase_parse(itr, end, mapnik::json::grammar::topology, space_type(), topo_); } catch (boost::spirit::x3::expectation_failure const& ex) { diff --git a/src/color_factory.cpp b/src/color_factory.cpp index 4ece73421..114723598 100644 --- a/src/color_factory.cpp +++ b/src/color_factory.cpp @@ -31,7 +31,7 @@ namespace mapnik { color parse_color(std::string const& str) { // TODO - early return for @color? - auto const& grammar = mapnik::color_grammar(); + auto const& grammar = mapnik::css_color_grammar::css_color; color c; std::string::const_iterator first = str.begin(); std::string::const_iterator last = str.end(); diff --git a/src/expression.cpp b/src/expression.cpp index 9c7c6c710..eabbb6b7c 100644 --- a/src/expression.cpp +++ b/src/expression.cpp @@ -38,12 +38,12 @@ expression_ptr parse_expression(std::string const& str) #if BOOST_VERSION >=106700 auto parser = boost::spirit::x3::with(tr) [ - mapnik::expression_grammar() + mapnik::grammar::expression ]; #else auto parser = boost::spirit::x3::with(std::ref(tr)) [ - mapnik::expression_grammar() + mapnik::grammar::expression ]; #endif bool r = false; diff --git a/src/json/extract_bounding_boxes_x3.cpp b/src/json/extract_bounding_boxes_x3.cpp index c1c073d27..819832fde 100644 --- a/src/json/extract_bounding_boxes_x3.cpp +++ b/src/json/extract_bounding_boxes_x3.cpp @@ -92,11 +92,10 @@ auto on_feature_callback = [] (auto const& ctx) x3::get(ctx)(_attr(ctx)); }; -namespace { auto const& geojson_value = geojson_grammar();} // import unicode string rule -namespace { auto const& geojson_string = unicode_string_grammar(); } +namespace { auto const& geojson_string = unicode_string; } // import positions rule -namespace { auto const& positions_rule = positions_grammar(); } +namespace { auto const& positions_rule = positions; } // extract bounding box from GeoJSON Feature diff --git a/src/json/feature_grammar_x3.cpp b/src/json/feature_grammar_x3.cpp index 0d03b3728..15ef359a8 100644 --- a/src/json/feature_grammar_x3.cpp +++ b/src/json/feature_grammar_x3.cpp @@ -29,16 +29,4 @@ BOOST_SPIRIT_INSTANTIATE(feature_grammar_type, iterator_type, feature_context_ty BOOST_SPIRIT_INSTANTIATE(geometry_grammar_type, iterator_type, phrase_parse_context_type); BOOST_SPIRIT_INSTANTIATE_UNUSED(feature_grammar_type, iterator_type, feature_context_const_type); -} - -grammar::feature_grammar_type const& feature_grammar() -{ - return grammar::feature_rule; -} - -grammar::geometry_grammar_type const& geometry_grammar() -{ - return grammar::geometry_rule; -} - -}} +}}} diff --git a/src/json/generic_json_grammar_x3.cpp b/src/json/generic_json_grammar_x3.cpp index 92931be33..43997d71e 100644 --- a/src/json/generic_json_grammar_x3.cpp +++ b/src/json/generic_json_grammar_x3.cpp @@ -34,15 +34,4 @@ BOOST_SPIRIT_INSTANTIATE_UNUSED(generic_json_grammar_type, iterator_type, phrase BOOST_SPIRIT_INSTANTIATE_UNUSED(generic_json_grammar_type, iterator_type, feature_context_type); BOOST_SPIRIT_INSTANTIATE_UNUSED(generic_json_grammar_type, iterator_type, feature_context_const_type); -} - -grammar::generic_json_grammar_type const& generic_json_grammar() -{ - return grammar::value; -} -grammar::generic_json_key_value_type const& generic_json_key_value() -{ - return grammar::key_value; -} - -}} +}}} diff --git a/src/json/geojson_grammar_x3.cpp b/src/json/geojson_grammar_x3.cpp index 583c9e999..368f4e10e 100644 --- a/src/json/geojson_grammar_x3.cpp +++ b/src/json/geojson_grammar_x3.cpp @@ -28,7 +28,7 @@ namespace mapnik { namespace json { namespace grammar { BOOST_SPIRIT_INSTANTIATE(geojson_grammar_type, iterator_type, context_type); -BOOST_SPIRIT_INSTANTIATE(key_value_type, iterator_type, context_type); +BOOST_SPIRIT_INSTANTIATE(geojson_key_value_type, iterator_type, context_type); BOOST_SPIRIT_INSTANTIATE(geojson_grammar_type, iterator_type, extract_bounding_boxes_context_type); @@ -38,16 +38,4 @@ BOOST_SPIRIT_INSTANTIATE_UNUSED(geojson_grammar_type, iterator_type, extract_bou BOOST_SPIRIT_INSTANTIATE_UNUSED(geojson_grammar_type, iterator_type, extract_bounding_boxes_context_type_f); BOOST_SPIRIT_INSTANTIATE_UNUSED(geojson_grammar_type, iterator_type, extract_bounding_boxes_reverse_context_type_f); -} - -grammar::geojson_grammar_type const& geojson_grammar() -{ - return grammar::value; -} - -grammar::key_value_type const& key_value_grammar() -{ - return grammar::key_value; -} - -}} +}}} diff --git a/src/json/geometry_from_geojson.cpp b/src/json/geometry_from_geojson.cpp index e83e607da..0d744c08f 100644 --- a/src/json/geometry_from_geojson.cpp +++ b/src/json/geometry_from_geojson.cpp @@ -32,7 +32,7 @@ bool from_geojson(std::string const& json, mapnik::geometry::geometry & { namespace x3 = boost::spirit::x3; using space_type = mapnik::json::grammar::space_type; - auto grammar = mapnik::json::geometry_grammar(); + auto grammar = mapnik::json::grammar::geometry_rule; try { const char* start = json.c_str(); diff --git a/src/json/parse_feature.cpp b/src/json/parse_feature.cpp index 9155ee306..e4843e7f4 100644 --- a/src/json/parse_feature.cpp +++ b/src/json/parse_feature.cpp @@ -34,11 +34,11 @@ void parse_feature(Iterator start, Iterator end, feature_impl& feature, mapnik:: #if BOOST_VERSION >= 106700 auto grammar = x3::with(tr) [x3::with(feature) - [ mapnik::json::feature_grammar() ]]; + [ mapnik::json::grammar::feature_rule ]]; #else auto grammar = x3::with(std::ref(tr)) [x3::with(std::ref(feature)) - [ mapnik::json::feature_grammar() ]]; + [ mapnik::json::grammar::feature_rule ]]; #endif if (!x3::phrase_parse(start, end, grammar, space_type())) { @@ -51,7 +51,7 @@ void parse_geometry(Iterator start, Iterator end, feature_impl& feature) { namespace x3 = boost::spirit::x3; using space_type = mapnik::json::grammar::space_type; - auto grammar = mapnik::json::geometry_grammar(); + auto grammar = mapnik::json::grammar::geometry_rule; if (!x3::phrase_parse(start, end, grammar, space_type(), feature.get_geometry())) { throw std::runtime_error("Can't parser GeoJSON Geometry"); diff --git a/src/json/positions_grammar_x3.cpp b/src/json/positions_grammar_x3.cpp index ab5a0f5fe..101f1c725 100644 --- a/src/json/positions_grammar_x3.cpp +++ b/src/json/positions_grammar_x3.cpp @@ -41,11 +41,4 @@ BOOST_SPIRIT_INSTANTIATE_UNUSED(positions_grammar_type, iterator_type, extract_b BOOST_SPIRIT_INSTANTIATE_UNUSED(positions_grammar_type, iterator_type, extract_bounding_boxes_context_type_f); BOOST_SPIRIT_INSTANTIATE_UNUSED(positions_grammar_type, iterator_type, extract_bounding_boxes_reverse_context_type_f); -} - -grammar::positions_grammar_type const& positions_grammar() -{ - return grammar::positions; -} - -}} +}}} diff --git a/src/json/topojson_grammar_x3.cpp b/src/json/topojson_grammar_x3.cpp index 536e4675a..1eef5e4b6 100644 --- a/src/json/topojson_grammar_x3.cpp +++ b/src/json/topojson_grammar_x3.cpp @@ -27,11 +27,4 @@ namespace mapnik { namespace json { namespace grammar { BOOST_SPIRIT_INSTANTIATE(topojson_grammar_type, iterator_type, phrase_parse_context_type); -} - -grammar::topojson_grammar_type const& topojson_grammar() -{ - return grammar::topology; -} - -}} +}}} diff --git a/src/json/unicode_string_grammar_x3.cpp b/src/json/unicode_string_grammar_x3.cpp index 80c2efc71..59838b7ab 100644 --- a/src/json/unicode_string_grammar_x3.cpp +++ b/src/json/unicode_string_grammar_x3.cpp @@ -42,11 +42,5 @@ BOOST_SPIRIT_INSTANTIATE_UNUSED(unicode_string_grammar_type, iterator_type, extr BOOST_SPIRIT_INSTANTIATE_UNUSED(unicode_string_grammar_type, iterator_type, extract_bounding_boxes_reverse_context_type); BOOST_SPIRIT_INSTANTIATE_UNUSED(unicode_string_grammar_type, iterator_type, extract_bounding_boxes_context_type_f); BOOST_SPIRIT_INSTANTIATE_UNUSED(unicode_string_grammar_type, iterator_type, extract_bounding_boxes_reverse_context_type_f); -} -grammar::unicode_string_grammar_type const& unicode_string_grammar() -{ - return grammar::unicode_string; -} - -}} +}}} diff --git a/src/parse_image_filters.cpp b/src/parse_image_filters.cpp index 8826e8b75..da1758e20 100644 --- a/src/parse_image_filters.cpp +++ b/src/parse_image_filters.cpp @@ -32,7 +32,7 @@ namespace filter { bool parse_image_filters(std::string const& str, std::vector & image_filters) { - auto const& grammar = mapnik::image_filter_grammar(); + auto const& grammar = mapnik::image_filter::start; auto itr = str.begin(); auto end = str.end(); diff --git a/src/parse_path.cpp b/src/parse_path.cpp index cf61a749c..4b20c9957 100644 --- a/src/parse_path.cpp +++ b/src/parse_path.cpp @@ -40,7 +40,7 @@ path_expression_ptr parse_path(std::string const& str) using boost::spirit::x3::standard_wide::space; std::string::const_iterator itr = str.begin(); std::string::const_iterator end = str.end(); - bool r = x3::phrase_parse(itr, end, path_expression_grammar(), space, *path); + bool r = x3::phrase_parse(itr, end, grammar::path_expression, space, *path); if (r && itr == end) { return path; diff --git a/src/parse_transform.cpp b/src/parse_transform.cpp index b4daa8458..934bd5ad6 100644 --- a/src/parse_transform.cpp +++ b/src/parse_transform.cpp @@ -40,12 +40,12 @@ transform_list_ptr parse_transform(std::string const& str, std::string const& en #if BOOST_VERSION >= 106700 auto const parser = boost::spirit::x3::with(tr) [ - mapnik::transform_expression_grammar() + mapnik::grammar::transform ]; #else auto const parser = boost::spirit::x3::with(std::ref(tr)) [ - mapnik::transform_expression_grammar() + mapnik::grammar::transform ]; #endif diff --git a/src/svg/svg_path_parser.cpp b/src/svg/svg_path_parser.cpp index 29c9b27ae..a99847996 100644 --- a/src/svg/svg_path_parser.cpp +++ b/src/svg/svg_path_parser.cpp @@ -43,11 +43,11 @@ bool parse_path(const char* wkt, PathType& p) #if BOOST_VERSION >= 106700 auto const grammar = x3::with(p) [ x3::with(relative) - [mapnik::svg::svg_path_grammar()]]; + [mapnik::svg::grammar::svg_path]]; #else auto const grammar = x3::with(std::ref(p)) [ x3::with(std::ref(relative)) - [mapnik::svg::svg_path_grammar()]]; + [mapnik::svg::grammar::svg_path]]; #endif try { diff --git a/src/svg/svg_points_parser.cpp b/src/svg/svg_points_parser.cpp index 5e21ce4c8..a931346a7 100644 --- a/src/svg/svg_points_parser.cpp +++ b/src/svg/svg_points_parser.cpp @@ -43,11 +43,11 @@ bool parse_points(const char* wkt, PathType& p) #if BOOST_VERSION >= 106700 auto const grammar = x3::with(p) [ x3::with(relative) - [mapnik::svg::svg_points_grammar()]]; + [mapnik::svg::grammar::svg_points]]; #else auto const grammar = x3::with(std::ref(p)) [ x3::with(std::ref(relative)) - [mapnik::svg::svg_points_grammar()]]; + [mapnik::svg::grammar::svg_points]]; #endif try { diff --git a/src/svg/svg_transform_parser.cpp b/src/svg/svg_transform_parser.cpp index e7f8863f3..df06a9a7b 100644 --- a/src/svg/svg_transform_parser.cpp +++ b/src/svg/svg_transform_parser.cpp @@ -40,11 +40,11 @@ bool parse_svg_transform(const char* wkt, Transform& tr) #if BOOST_VERSION >= 106700 auto const grammar = x3::with(tr) - [mapnik::svg::svg_transform_grammar()]; + [mapnik::svg::grammar::svg_transform]; #else auto const grammar = x3::with(std::ref(tr)) - [mapnik::svg::svg_transform_grammar()]; + [mapnik::svg::grammar::svg_transform]; #endif try diff --git a/src/wkt/wkt_factory.cpp b/src/wkt/wkt_factory.cpp index 31bc6da74..ef28aabd9 100644 --- a/src/wkt/wkt_factory.cpp +++ b/src/wkt/wkt_factory.cpp @@ -35,7 +35,7 @@ bool from_wkt(std::string const& wkt, mapnik::geometry::geometry & geom) bool result; try { - result = x3::phrase_parse(itr, end, wkt_grammar(), space, geom); + result = x3::phrase_parse(itr, end, grammar::wkt, space, geom); } catch (x3::expectation_failure const& ex) { diff --git a/test/unit/color/css_color.cpp b/test/unit/color/css_color.cpp index f40402d88..01b9f29e4 100644 --- a/test/unit/color/css_color.cpp +++ b/test/unit/color/css_color.cpp @@ -21,7 +21,7 @@ TEST_CASE("CSS color") { SECTION("CSS colors") { - auto const& color_grammar = mapnik::color_grammar(); + auto const& color_grammar = mapnik::css_color_grammar::css_color; boost::spirit::x3::ascii::space_type space; { // rgb diff --git a/test/unit/datasource/topojson.cpp b/test/unit/datasource/topojson.cpp index e109c75b2..4e79ebe4b 100644 --- a/test/unit/datasource/topojson.cpp +++ b/test/unit/datasource/topojson.cpp @@ -58,7 +58,7 @@ bool parse_topology_string(std::string const& buffer, mapnik::topojson::topology char const* end = itr + buffer.length(); try { - boost::spirit::x3::phrase_parse(itr, end, mapnik::json::topojson_grammar(), space_type() , topo); + boost::spirit::x3::phrase_parse(itr, end, mapnik::json::grammar::topology, space_type() , topo); } catch (boost::spirit::x3::expectation_failure const& ex) { diff --git a/utils/mapnik-index/process_geojson_file_x3.cpp b/utils/mapnik-index/process_geojson_file_x3.cpp index 4f12adbdf..88a15406c 100644 --- a/utils/mapnik-index/process_geojson_file_x3.cpp +++ b/utils/mapnik-index/process_geojson_file_x3.cpp @@ -224,7 +224,7 @@ using box_type = mapnik::box2d; using boxes_type = std::vector>>; using base_iterator_type = char const*; -auto const& geojson_value = mapnik::json::geojson_grammar(); +auto const& geojson_value = mapnik::json::grammar::geojson_value; }