diff --git a/include/mapnik/json/topojson_grammar_x3_def.hpp b/include/mapnik/json/topojson_grammar_x3_def.hpp index aa040c371..6a5d6920e 100644 --- a/include/mapnik/json/topojson_grammar_x3_def.hpp +++ b/include/mapnik/json/topojson_grammar_x3_def.hpp @@ -255,13 +255,23 @@ auto assign_properties = [] (auto const& ctx) std::get<3>(_val(ctx)) = std::move(_attr(ctx)); }; +auto assign_prop_name = [] (auto const& ctx) +{ + std::get<0>(_val(ctx)) = std::move(_attr(ctx)); +}; + +auto assign_prop_value = [] (auto const& ctx) +{ + std::get<1>(_val(ctx)) = std::move(_attr(ctx)); +}; + namespace x3 = boost::spirit::x3; using x3::lit; using x3::double_; using x3::int_; using x3::omit; - +using x3::char_; namespace { // import unicode string rule @@ -296,6 +306,7 @@ topojson_grammar_type const topology = "Topology"; x3::rule transform = "Transform"; x3::rule bbox = "Bounding Box"; x3::rule> objects= "Objects"; +x3::rule property = "Property"; x3::rule properties = "Properties"; x3::rule geometry = "Geometry"; x3::rule> geometry_collection = "Geometry Collection"; @@ -346,7 +357,7 @@ auto const bbox_def = lit("\"bbox\"") > lit(':') auto const objects_def = lit("\"objects\"") > lit(':') > lit('{') - > ((omit[json_string] > lit(':') > ((geometry_collection[push_collection] | geometry[push_geometry]))) % lit(',')) + > ((omit[*~char_(':')] > lit(':') > ((geometry_collection[push_collection] | geometry[push_geometry]))) % lit(',')) > lit('}') ; @@ -359,7 +370,7 @@ auto const geometry_tuple_def = | properties[assign_properties] | - omit[json_string >> lit(':') >> json_value]) % lit(',') + omit[json_string] > lit(':') > omit[json_value]) % lit(',') ; auto const geometry_def = lit("{") > geometry_tuple[create_geometry] > lit("}"); @@ -384,9 +395,12 @@ auto const rings_array_def = (lit('[') >> (rings % lit(',')) >> lit(']')) ring ; +auto const property_def = json_string[assign_prop_name] > lit(':') > json_value[assign_prop_value] + ; + auto const properties_def = lit("\"properties\"") > lit(':') - > lit('{') > (json_string > lit(':') > json_value) % lit(',') > lit('}') + > lit('{') > (property % lit(',')) > lit('}') ; auto const arcs_def = lit("\"arcs\"") >> lit(':') >> lit('[') >> -( arc % lit(',')) >> lit(']') ; @@ -408,6 +422,7 @@ BOOST_SPIRIT_DEFINE( ring, rings, rings_array, + property, properties, arcs, arc, diff --git a/src/json/unicode_string_grammar_x3.cpp b/src/json/unicode_string_grammar_x3.cpp index f3969feec..76c0e731e 100644 --- a/src/json/unicode_string_grammar_x3.cpp +++ b/src/json/unicode_string_grammar_x3.cpp @@ -23,11 +23,6 @@ #include #include #include -#include -#pragma GCC diagnostic push -#include -#include -#pragma GCC diagnostic pop namespace mapnik { namespace json { namespace grammar { @@ -48,9 +43,4 @@ BOOST_SPIRIT_INSTANTIATE_UNUSED(unicode_string_grammar_type, iterator_type, extr 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); -using attribute_type = boost::fusion::iterator_range, 0>, boost::fusion::std_tuple_iterator, 1>>; - -template bool mapnik::json::grammar::parse_rule ( - unicode_string_grammar_type, iterator_type&, iterator_type const&, phrase_parse_context_type const&, attribute_type &); - }}}