diff --git a/Makefile b/Makefile index e3b4b53dc..23e95cef3 100755 --- a/Makefile +++ b/Makefile @@ -28,7 +28,8 @@ src/json/libmapnik-json.a: src/renderer_common/render_thunk_extractor.os \ src/json/libmapnik-json.a \ src/wkt/libmapnik-wkt.a \ - src/css_color_grammar_x3.os \ + src/css/css_grammar_x3.os \ + src/css/css_color_grammar_x3.os \ src/expression_grammar_x3.os \ src/transform_expression_grammar_x3.os \ src/image_filter_grammar_x3.os \ diff --git a/include/build.py b/include/build.py index fab900426..54058f8cd 100644 --- a/include/build.py +++ b/include/build.py @@ -28,6 +28,7 @@ subdirglobs = [ ('.', 'mapnik/*.hpp'), ('agg', '../deps/agg/include/agg*'), ('cairo', 'mapnik/cairo/*.hpp'), + ('css', 'mapnik/css/*.hpp'), ('csv', 'mapnik/csv/*.hpp'), ('deps/mapbox', '../deps/mapbox/variant/include/mapbox/*.hpp'), ('deps/mapbox', '../deps/mapbox/geometry/include/mapbox/*.hpp'), diff --git a/include/mapnik/css_color_grammar_x3.hpp b/include/mapnik/css/css_color_grammar_x3.hpp similarity index 100% rename from include/mapnik/css_color_grammar_x3.hpp rename to include/mapnik/css/css_color_grammar_x3.hpp diff --git a/include/mapnik/css_color_grammar_x3_def.hpp b/include/mapnik/css/css_color_grammar_x3_def.hpp similarity index 99% rename from include/mapnik/css_color_grammar_x3_def.hpp rename to include/mapnik/css/css_color_grammar_x3_def.hpp index 220523e85..173ae09cd 100644 --- a/include/mapnik/css_color_grammar_x3_def.hpp +++ b/include/mapnik/css/css_color_grammar_x3_def.hpp @@ -25,7 +25,7 @@ #ifndef MAPNIK_CSS_COLOR_GRAMMAR_X3_DEF_HPP #define MAPNIK_CSS_COLOR_GRAMMAR_X3_DEF_HPP -#include +#include #include #include diff --git a/include/mapnik/image_filter_grammar_x3_def.hpp b/include/mapnik/image_filter_grammar_x3_def.hpp index 64af7e5cc..e1c6f64ae 100644 --- a/include/mapnik/image_filter_grammar_x3_def.hpp +++ b/include/mapnik/image_filter_grammar_x3_def.hpp @@ -26,7 +26,7 @@ #include #include -#include +#include #pragma GCC diagnostic push #include diff --git a/src/build.py b/src/build.py index 4c3ded137..3231a0085 100644 --- a/src/build.py +++ b/src/build.py @@ -152,7 +152,6 @@ else: # unix, non-macos source = Split( """ expression_grammar_x3.cpp - css_color_grammar_x3.cpp fs.cpp request.cpp well_known_srs.cpp @@ -225,6 +224,8 @@ source = Split( raster_colorizer.cpp mapped_memory_cache.cpp marker_cache.cpp + css/css_color_grammar_x3.cpp + css/css_grammar_x3.cpp svg/svg_parser.cpp svg/svg_path_parser.cpp svg/svg_points_parser.cpp diff --git a/src/color_factory.cpp b/src/color_factory.cpp index 114723598..9cd8e21f5 100644 --- a/src/color_factory.cpp +++ b/src/color_factory.cpp @@ -24,7 +24,7 @@ #include #include #include -#include +#include namespace mapnik { diff --git a/src/css_color_grammar_x3.cpp b/src/css/css_color_grammar_x3.cpp similarity index 85% rename from src/css_color_grammar_x3.cpp rename to src/css/css_color_grammar_x3.cpp index 8d141a390..cab594861 100644 --- a/src/css_color_grammar_x3.cpp +++ b/src/css/css_color_grammar_x3.cpp @@ -20,7 +20,8 @@ * *****************************************************************************/ -#include +#include +#include #if BOOST_VERSION < 107000 #include #endif @@ -29,8 +30,10 @@ namespace mapnik { namespace css_color_grammar { namespace x3 = boost::spirit::x3; using iterator_type = std::string::const_iterator; using context_type = x3::phrase_parse_context::type; +using context_skipper_type = x3::phrase_parse_context::type; BOOST_SPIRIT_INSTANTIATE(css_color_grammar_type, iterator_type, context_type); +BOOST_SPIRIT_INSTANTIATE(css_color_grammar_type, iterator_type, context_skipper_type); #if BOOST_VERSION < 107000 template bool parse_rule diff --git a/src/css/css_grammar_x3.cpp b/src/css/css_grammar_x3.cpp new file mode 100644 index 000000000..f57ff29bb --- /dev/null +++ b/src/css/css_grammar_x3.cpp @@ -0,0 +1,58 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2020 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 + * + *****************************************************************************/ + +#include +#include + +namespace mapnik { namespace css_grammar { + +namespace x3 = boost::spirit::x3; +using iterator_type = std::string::const_iterator; +using context_type = x3::phrase_parse_context::type; + +BOOST_SPIRIT_INSTANTIATE(ident_grammar_type, iterator_type, context_type); +BOOST_SPIRIT_INSTANTIATE(css_classes_type, iterator_type, context_type); +BOOST_SPIRIT_INSTANTIATE(css_grammar_type, iterator_type, context_type); +BOOST_SPIRIT_INSTANTIATE(css_skipper_type, iterator_type, x3::unused_type); +} + + +css_grammar::ident_grammar_type const ident_grammar() +{ + return css_grammar::ident; +} + +css_grammar::css_classes_type const classes() +{ + return css_grammar::css_classes; +} + +css_grammar::css_grammar_type const grammar() +{ + return css_grammar::css_grammar; +} + +css_grammar::css_skipper_type const skipper() +{ + return css_grammar::css_skipper; +} +} diff --git a/test/unit/color/css_color.cpp b/test/unit/color/css_color.cpp index 01b9f29e4..7279237da 100644 --- a/test/unit/color/css_color.cpp +++ b/test/unit/color/css_color.cpp @@ -2,8 +2,8 @@ #include #include -#include -#include +#include +#include #include