Add CSS parser grammar + move into separate include/css and src/css dirs.
This commit is contained in:
parent
3be9ce8fa0
commit
00b888c1ef
10 changed files with 72 additions and 8 deletions
3
Makefile
3
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 \
|
||||
|
|
|
@ -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'),
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#ifndef MAPNIK_CSS_COLOR_GRAMMAR_X3_DEF_HPP
|
||||
#define MAPNIK_CSS_COLOR_GRAMMAR_X3_DEF_HPP
|
||||
|
||||
#include <mapnik/css_color_grammar_x3.hpp>
|
||||
#include <mapnik/css/css_color_grammar_x3.hpp>
|
||||
#include <mapnik/util/hsl.hpp>
|
||||
#include <mapnik/safe_cast.hpp>
|
||||
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
#include <mapnik/image_filter_grammar_x3.hpp>
|
||||
#include <mapnik/image_filter_types.hpp>
|
||||
#include <mapnik/css_color_grammar_x3.hpp>
|
||||
#include <mapnik/css/css_color_grammar_x3.hpp>
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#include <mapnik/warning_ignore.hpp>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include <mapnik/color.hpp>
|
||||
#include <mapnik/color_factory.hpp>
|
||||
#include <mapnik/config_error.hpp>
|
||||
#include <mapnik/css_color_grammar_x3.hpp>
|
||||
#include <mapnik/css/css_color_grammar_x3.hpp>
|
||||
|
||||
namespace mapnik {
|
||||
|
||||
|
|
|
@ -20,7 +20,8 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#include <mapnik/css_color_grammar_x3_def.hpp>
|
||||
#include <mapnik/css/css_grammar_x3.hpp>
|
||||
#include <mapnik/css/css_color_grammar_x3_def.hpp>
|
||||
#if BOOST_VERSION < 107000
|
||||
#include <mapnik/image_filter_types.hpp>
|
||||
#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<x3::ascii::space_type>::type;
|
||||
using context_skipper_type = x3::phrase_parse_context<css_grammar::css_skipper_type>::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<iterator_type, context_type, mapnik::filter::color_to_alpha>
|
58
src/css/css_grammar_x3.cpp
Normal file
58
src/css/css_grammar_x3.cpp
Normal file
|
@ -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 <mapnik/css/css_grammar_x3_def.hpp>
|
||||
#include <mapnik/css/css_color_grammar_x3.hpp>
|
||||
|
||||
namespace mapnik { namespace css_grammar {
|
||||
|
||||
namespace x3 = boost::spirit::x3;
|
||||
using iterator_type = std::string::const_iterator;
|
||||
using context_type = x3::phrase_parse_context<css_skipper_type>::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;
|
||||
}
|
||||
}
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
#include <mapnik/safe_cast.hpp>
|
||||
#include <mapnik/color.hpp>
|
||||
#include <mapnik/css_color_grammar_x3.hpp>
|
||||
#include <mapnik/css_color_grammar_x3_def.hpp>
|
||||
#include <mapnik/css/css_color_grammar_x3.hpp>
|
||||
#include <mapnik/css/css_color_grammar_x3_def.hpp>
|
||||
|
||||
#include <sstream>
|
||||
|
||||
|
|
Loading…
Reference in a new issue