refactor path_expression_grammar

This commit is contained in:
artemp 2016-09-15 15:41:31 +02:00 committed by Mickey Rose
parent d2f64604a3
commit 67468ef356
5 changed files with 41 additions and 13 deletions

View file

@ -39,6 +39,10 @@ using path_expression_grammar_type = x3::rule<path_expression_class, path_expres
BOOST_SPIRIT_DECLARE(path_expression_grammar_type); BOOST_SPIRIT_DECLARE(path_expression_grammar_type);
}} }
grammar::path_expression_grammar_type const& path_expression_grammar();
}
#endif // MAPNIK_PATH_EXPRESSIONS_GRAMMAR_X3_HPP #endif // MAPNIK_PATH_EXPRESSIONS_GRAMMAR_X3_HPP

View file

@ -53,7 +53,7 @@ BOOST_SPIRIT_DEFINE(
namespace mapnik { namespace mapnik {
grammar::path_expression_grammar_type path_expression_grammar() grammar::path_expression_grammar_type const& path_expression_grammar()
{ {
return grammar::path_expression; return grammar::path_expression;
} }

View file

@ -185,6 +185,7 @@ source = Split(
font_set.cpp font_set.cpp
function_call.cpp function_call.cpp
gradient.cpp gradient.cpp
path_expression_grammar_x3.cpp
parse_path.cpp parse_path.cpp
image_reader.cpp image_reader.cpp
cairo_io.cpp cairo_io.cpp

View file

@ -2,7 +2,7 @@
* *
* This file is part of Mapnik (c++ mapping toolkit) * This file is part of Mapnik (c++ mapping toolkit)
* *
* Copyright (C) 2015 Artem Pavlenko * Copyright (C) 2016 Artem Pavlenko
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -27,20 +27,11 @@
#include <mapnik/value.hpp> #include <mapnik/value.hpp>
#include <mapnik/path_expression_grammar_x3.hpp> #include <mapnik/path_expression_grammar_x3.hpp>
#include <mapnik/path_expression_grammar_x3_def.hpp>
// stl // stl
#include <stdexcept> #include <stdexcept>
namespace mapnik { namespace grammar { namespace mapnik {
namespace x3 = boost::spirit::x3;
using iterator_type = std::string::const_iterator;
using context_type = x3::phrase_parse_context<x3::standard_wide::space_type>::type;
BOOST_SPIRIT_INSTANTIATE(path_expression_grammar_type, iterator_type, context_type);
}
path_expression_ptr parse_path(std::string const& str) path_expression_ptr parse_path(std::string const& str)
{ {

View file

@ -0,0 +1,32 @@
/*****************************************************************************
*
* This file is part of Mapnik (c++ mapping toolkit)
*
* Copyright (C) 2016 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/path_expression_grammar_x3_def.hpp>
namespace mapnik { namespace grammar {
namespace x3 = boost::spirit::x3;
using iterator_type = std::string::const_iterator;
using context_type = x3::phrase_parse_context<x3::standard_wide::space_type>::type;
BOOST_SPIRIT_INSTANTIATE(path_expression_grammar_type, iterator_type, context_type);
}}