attempting to fix #3793

This commit is contained in:
Artem Pavlenko 2017-11-14 10:09:29 +01:00
parent 97f520c7cf
commit 3cb74f0871
12 changed files with 74 additions and 73 deletions

View file

@ -140,11 +140,12 @@ using x3::omit;
using x3::char_;
namespace {
auto const& value = generic_json_grammar();
// import unicode string rule
auto const& geojson_string = unicode_string_grammar();
// import positions rule
auto const& positions_rule = positions_grammar();
// import generic rule
auto const& value = generic_json_grammar();
}
// geometry types symbols
@ -235,13 +236,15 @@ auto assign_property = [](auto const& ctx)
//exported rules
feature_grammar_type const feature_rule = "Feature Rule";
geometry_grammar_type const geometry_rule = "Feature Rule";
geometry_grammar_type const geometry_rule = "Geometry Rule";
// rules
x3::rule<struct feature_type_tag> const feature_type = "Feature Type";
x3::rule<struct geometry_type_tag, mapnik::geometry::geometry_types> const geometry_type = "Geometry Type";
x3::rule<struct coordinates_tag, mapnik::json::positions> const coordinates = "Coordinates";
x3::rule<struct geomerty_tag, std::tuple<mapnik::geometry::geometry_types, mapnik::json::positions, mapnik::geometry::geometry_collection<double>>> const geometry_tuple = "Geometry";
x3::rule<struct geomerty_tag, std::tuple<mapnik::geometry::geometry_types,
mapnik::json::positions,
mapnik::geometry::geometry_collection<double>>> const geometry_tuple = "Geometry";
x3::rule<struct property, std::tuple<std::string, json_value>> const property = "Property";
x3::rule<struct properties_tag> const properties = "Properties";
x3::rule<struct feature_part_rule_tag> const feature_part = "Feature part";
@ -305,18 +308,4 @@ BOOST_SPIRIT_DEFINE(
}}}
namespace mapnik { namespace json {
grammar::feature_grammar_type const& feature_grammar()
{
return grammar::feature_rule;
}
grammar::geometry_grammar_type const& geometry_grammar()
{
return grammar::geometry_rule;
}
}}
#endif // MAPNIK_JSON_FEATURE_GRAMMAR_X3_DEF_HPP

View file

@ -67,6 +67,10 @@ auto assign_value = [](auto const& ctx)
using x3::lit;
using x3::string;
// import unicode string rule
namespace { auto const& json_string = mapnik::json::unicode_string_grammar(); }
// exported rules
// start
generic_json_grammar_type const value("JSON Value");
@ -79,9 +83,7 @@ x3::rule<class json_number_tag, json_value> const number("JSON Number");
auto const json_double = x3::real_parser<value_double, x3::strict_real_policies<value_double>>();
auto const json_integer = x3::int_parser<value_integer, 10, 1, -1>();
// import unicode string rule
namespace { auto const& json_string = mapnik::json::unicode_string_grammar(); }
// generic json types
// generic json types
auto const value_def = object | array | json_string | number
;
@ -120,17 +122,5 @@ BOOST_SPIRIT_DEFINE(
}}}
namespace mapnik { namespace json {
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;
}
}}
#endif // MAPNIK_JSON_GENERIC_JSON_GRAMMAR_X3_DEF_HPP

View file

@ -166,18 +166,4 @@ BOOST_SPIRIT_DEFINE(
}}}
namespace mapnik { namespace json {
grammar::geojson_grammar_type const& geojson_grammar()
{
return grammar::value;
}
grammar::key_value_type const& key_value_grammar()
{
return grammar::key_value;
}
}}
#endif // MAPNIK_JSON_GEOJSON_GRAMMAR_X3_DEF_HPP

View file

@ -64,11 +64,4 @@ BOOST_SPIRIT_DEFINE(
);
}}}
namespace mapnik { namespace json {
grammar::positions_grammar_type const& positions_grammar()
{
return grammar::positions;
}
}}
#endif // MAPNIK_JSON_POSITIONS_GRAMMAR_X3_DEF_HPP

View file

@ -23,9 +23,9 @@
#ifndef MAPNIK_JSON_TOPOJSON_GRAMMAR_X3_DEF_HPP
#define MAPNIK_JSON_TOPOJSON_GRAMMAR_X3_DEF_HPP
#include <mapnik/json/topojson_grammar_x3.hpp>
#include <mapnik/json/unicode_string_grammar_x3.hpp>
#include <mapnik/json/generic_json_grammar_x3.hpp>
#include <mapnik/json/topojson_grammar_x3.hpp>
#pragma GCC diagnostic push
#include <mapnik/warning_ignore.hpp>
#include <boost/fusion/adapted/struct.hpp>
@ -435,11 +435,4 @@ BOOST_SPIRIT_DEFINE(
}}}
namespace mapnik { namespace json {
grammar::topojson_grammar_type const& topojson_grammar()
{
return grammar::topology;
}
}}
#endif //MAPNIK_TOPOJSON_GRAMMAR_X3_DEF_HPP

View file

@ -149,11 +149,6 @@ BOOST_SPIRIT_DEFINE(
#pragma GCC diagnostic pop
}
grammar::unicode_string_grammar_type const& unicode_string_grammar()
{
return grammar::unicode_string;
}
}}
}}}
#endif // MAPNIK_JSON_UNICODE_STRING_GRAMMAR_X3_DEF_HPP

View file

@ -31,4 +31,16 @@ BOOST_SPIRIT_INSTANTIATE(geometry_grammar_type, iterator_type, phrase_parse_cont
BOOST_SPIRIT_INSTANTIATE_UNUSED(feature_grammar_type, iterator_type, feature_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;
}
}}

View file

@ -34,4 +34,15 @@ 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;
}
}}

View file

@ -38,4 +38,16 @@ 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;
}
}}

View file

@ -41,4 +41,11 @@ 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;
}
}}

View file

@ -27,4 +27,11 @@ 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;
}
}}

View file

@ -42,5 +42,11 @@ 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;
}
}}