Revert "avoid symbols duplication"

This reverts commit c737f4d56f.
This commit is contained in:
Artem Pavlenko 2018-03-15 15:58:23 +01:00
parent c737f4d56f
commit a8d7fc1cfb
8 changed files with 13 additions and 26 deletions

View file

@ -38,9 +38,9 @@ using x3::lit;
using x3::lexeme;
using ascii::char_;
struct csv_unesc_chars_ : x3::symbols<char>
struct unesc_char_ : x3::symbols<char>
{
csv_unesc_chars_()
unesc_char_()
{
add("\\a", '\a')
("\\b", '\b')
@ -55,7 +55,7 @@ struct csv_unesc_chars_ : x3::symbols<char>
("\"\"", '\"') // double quote
;
}
} csv_unesc_chars;
} unesc_char;
template <typename T>
struct literal : x3::parser<literal<T>>
@ -97,7 +97,7 @@ auto const column_def = quoted_text | *(char_ - separator)
auto const quoted_text_def = quote > text > quote // support unmatched quotes or not (??)
;
auto const text_def = *(csv_unesc_chars | (char_ - quote))
auto const text_def = *(unesc_char | (char_ - quote))
;
BOOST_SPIRIT_DEFINE (

View file

@ -24,7 +24,7 @@
#define MAPNIK_EXPRESSIONS_GRAMMAR_X3_DEF_HPP
#include <mapnik/expression_grammar_x3.hpp>
#include <mapnik/json/unicode_string_grammar_x3.hpp>
#include <mapnik/json/unicode_string_grammar_x3_def.hpp>
#include <mapnik/expression_node.hpp>
#include <mapnik/function_call.hpp>
#include <mapnik/unicode.hpp>
@ -67,7 +67,7 @@ namespace mapnik { namespace grammar {
x3::uint_parser<char, 16, 2, 2> const hex2 {};
namespace {
auto const& escaped_unicode = json::escaped_unicode_grammar();
auto const& escaped_unicode = json::grammar::escaped_unicode;
}
auto append = [](auto const& ctx)

View file

@ -74,7 +74,7 @@ namespace { auto const& json_string = mapnik::json::unicode_string_grammar(); }
// exported rules
// start
generic_json_grammar_type const value MAPNIK_INIT_PRIORITY(103) ("JSON Value");
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<class json_object_tag, json_object> const object("JSON Object");

View file

@ -43,7 +43,7 @@ auto assign_helper = [](auto const& ctx)
} // anonymous ns
// start rule
positions_grammar_type const positions MAPNIK_INIT_PRIORITY(104) ("Positions");
positions_grammar_type const positions MAPNIK_INIT_PRIORITY(103) ("Positions");
// rules
x3::rule<class point_class, point> const point("Position");
x3::rule<class ring_class, ring> const ring("Ring");

View file

@ -306,7 +306,7 @@ struct topojson_geometry_type_ : x3::symbols<int>
} topojson_geometry_type;
// start rule
topojson_grammar_type const topology MAPNIK_INIT_PRIORITY(105) ("Topology");
topojson_grammar_type const topology MAPNIK_INIT_PRIORITY(104) ("Topology");
// rules
x3::rule<class transform_tag, mapnik::topojson::transform> const transform = "Transform";
x3::rule<class bbox_tag, mapnik::topojson::bounding_box> const bbox = "Bounding Box";

View file

@ -33,15 +33,12 @@ namespace mapnik { namespace json { namespace grammar {
namespace x3 = boost::spirit::x3;
using unicode_string_grammar_type = x3::rule<class unicode_string_tag, std::string>;
using escaped_unicode_type = x3::rule<class escaped_unicode_tag, std::string>;
BOOST_SPIRIT_DECLARE(unicode_string_grammar_type);
BOOST_SPIRIT_DECLARE(escaped_unicode_type);
}
grammar::unicode_string_grammar_type const& unicode_string_grammar();
grammar::escaped_unicode_type const& escaped_unicode_grammar();
}}

View file

@ -110,11 +110,11 @@ x3::uint_parser<std::uint16_t, 16, 4, 4> const hex4 {};
x3::uint_parser<uchar, 16, 8, 8> const hex8 {};
// start rule
unicode_string_grammar_type const unicode_string MAPNIK_INIT_PRIORITY(102) ("Unicode String");
unicode_string_grammar_type const unicode_string MAPNIK_INIT_PRIORITY(101) ("Unicode String");
// rules
x3::rule<class double_quoted_tag, std::string> const double_quoted("Double-quoted string");
x3::rule<class escaped_tag, std::string> const escaped("Escaped Character");
escaped_unicode_type const escaped_unicode MAPNIK_INIT_PRIORITY(101) ("Escaped Unicode code point(s)");
x3::rule<class escaped_unicode_tag, std::string> const escaped_unicode("Escaped Unicode code point(s)");
x3::rule<class utf16_string_tag, std::vector<std::uint16_t>> const utf16_string("UTF16 encoded string");
auto unicode_string_def = double_quoted

View file

@ -22,19 +22,9 @@
#include <mapnik/expression_grammar_x3_def.hpp>
#include <mapnik/expression_grammar_x3_config.hpp>
#include <mapnik/json/unicode_string_grammar_x3_def.hpp>
namespace mapnik { namespace json { namespace grammar {
BOOST_SPIRIT_INSTANTIATE(unicode_string_grammar_type, mapnik::grammar::iterator_type, mapnik::grammar::context_type);
}
grammar::escaped_unicode_type const& escaped_unicode_grammar()
{
return grammar::escaped_unicode;
}
}}
namespace mapnik { namespace grammar {
BOOST_SPIRIT_INSTANTIATE(expression_grammar_type, iterator_type, context_type);
}}