Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r67223 - sandbox/configurator/boost/configurator/detail
From: for.dshevchenko_at_[hidden]
Date: 2010-12-13 15:07:15


Author: dshevchenko
Date: 2010-12-13 15:07:13 EST (Mon, 13 Dec 2010)
New Revision: 67223
URL: http://svn.boost.org/trac/boost/changeset/67223

Log:
Add

Added:
   sandbox/configurator/boost/configurator/detail/grammars.hpp (contents, props changed)
Text files modified:
   sandbox/configurator/boost/configurator/detail/pure_options_obtainer.hpp | 21 ++++++++++++---------
   1 files changed, 12 insertions(+), 9 deletions(-)

Added: sandbox/configurator/boost/configurator/detail/grammars.hpp
==============================================================================
--- (empty file)
+++ sandbox/configurator/boost/configurator/detail/grammars.hpp 2010-12-13 15:07:13 EST (Mon, 13 Dec 2010)
@@ -0,0 +1,135 @@
+// detail/grammars.hpp
+// ~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (C) 2010 Denis Shevchenko (for @ dshevchenko.biz)
+//
+// Distributed under the Boost Software License, version 1.0
+// (see http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_CONFIGURATOR_GRAMMARS_HPP
+#define BOOST_CONFIGURATOR_GRAMMARS_HPP
+
+#include <boost/spirit/include/qi.hpp>
+#include <boost/spirit/include/phoenix_core.hpp>
+#include <boost/spirit/include/phoenix_operator.hpp>
+#include <boost/spirit/include/phoenix_stl.hpp>
+#include <boost/fusion/include/adapt_struct.hpp>
+
+#include <string>
+
+namespace boost {
+
+/// \namespace cf
+/// \brief Main namespace of library.
+namespace cf {
+
+/// \namespace cf::detail
+/// \brief Details of realization.
+namespace detail {
+
+struct obtained_option {
+ std::string name;
+ std::string value;
+};
+
+} // namespace detail
+} // namespace cf
+} // namespace boost
+
+BOOST_FUSION_ADAPT_STRUCT(
+ boost::cf::detail::obtained_option,
+ (std::string, name)
+ (std::string, value)
+)
+
+namespace boost {
+
+/// \namespace cf
+/// \brief Main namespace of library.
+namespace cf {
+
+/// \namespace cf::detail
+/// \brief Details of realization.
+namespace detail {
+
+template< typename Iterator >
+struct obtained_option_parser_space : boost::spirit::qi::grammar< Iterator
+ , obtained_option()
+ , boost::spirit::ascii::space_type > {
+ obtained_option_parser_space() :
+ obtained_option_parser_space::base_type( start ) {
+ using boost::spirit::qi::lexeme;
+ using boost::spirit::qi::char_;
+
+ name_extractor %= lexeme[ +( char_ - ' ' ) ];
+ value_extractor %= lexeme[ +( char_ - ' ' ) ];
+ start %= name_extractor >> value_extractor;
+ }
+public:
+ boost::spirit::qi::rule
+ <
+ Iterator
+ , std::string()
+ , boost::spirit::ascii::space_type
+ >
+ name_extractor;
+ boost::spirit::qi::rule
+ <
+ Iterator
+ , std::string()
+ , boost::spirit::ascii::space_type
+ >
+ value_extractor;
+ boost::spirit::qi::rule
+ <
+ Iterator
+ , obtained_option()
+ , boost::spirit::ascii::space_type
+ >
+ start;
+};
+
+template< typename Iterator >
+struct obtained_option_parser : boost::spirit::qi::grammar< Iterator
+ , obtained_option()
+ , boost::spirit::ascii::space_type > {
+ obtained_option_parser( char separator ) :
+ obtained_option_parser::base_type( start ) {
+ using boost::spirit::qi::lexeme;
+ using boost::spirit::qi::char_;
+ using boost::spirit::qi::skip;
+ using boost::spirit::ascii::space;
+
+ name_extractor %= skip( space )[ +( char_ - separator ) ];
+ value_extractor %= skip( space )[ +( char_ - separator ) ];
+ start %= name_extractor >> separator >> value_extractor;
+ }
+public:
+ boost::spirit::qi::rule
+ <
+ Iterator
+ , std::string()
+ , boost::spirit::ascii::space_type
+ >
+ name_extractor;
+ boost::spirit::qi::rule
+ <
+ Iterator
+ , std::string()
+ , boost::spirit::ascii::space_type
+ >
+ value_extractor;
+ boost::spirit::qi::rule
+ <
+ Iterator
+ , obtained_option()
+ , boost::spirit::ascii::space_type
+ >
+ start;
+};
+
+} // namespace detail
+} // namespace cf
+} // namespace boost
+
+#endif // BOOST_CONFIGURATOR_GRAMMARS_HPP

Modified: sandbox/configurator/boost/configurator/detail/pure_options_obtainer.hpp
==============================================================================
--- sandbox/configurator/boost/configurator/detail/pure_options_obtainer.hpp (original)
+++ sandbox/configurator/boost/configurator/detail/pure_options_obtainer.hpp 2010-12-13 15:07:13 EST (Mon, 13 Dec 2010)
@@ -12,15 +12,12 @@
 #include <boost/configurator/detail/types.hpp>
 #include <boost/configurator/detail/misc.hpp>
 #include <boost/configurator/detail/pure_option.hpp>
+#include <boost/configurator/detail/grammars.hpp>
 #include <boost/configurator/option.hpp>
+#include <boost/algorithm/string.hpp>
 #include <boost/function.hpp>
 #include <boost/assign.hpp>
 #include <boost/foreach.hpp>
-#include <boost/algorithm/string.hpp>
-#include <boost/spirit/include/qi.hpp>
-#include <boost/spirit/include/phoenix_core.hpp>
-#include <boost/spirit/include/phoenix_operator.hpp>
-#include <boost/spirit/include/phoenix_stl.hpp>
 
 #include <string>
 #include <vector>
@@ -36,10 +33,6 @@
 /// \brief Details of realization.
 namespace detail {
 
-using boost::spirit::qi::char_;
-using boost::spirit::qi::string;
-using boost::spirit::qi::parse;
-
 class pure_options_obtainer {
     typedef boost::function< bool ( std::string& /* analized string */
                                     , pure_options& /* factual obtained options */ ) >
@@ -101,6 +94,9 @@
     }
 private:
     bool handle_section_opening( std::string& s, pure_options& /* factual_obtained_options */ ) {
+
+
+ /*
         using boost::spirit::qi::_1;
         using boost::phoenix::push_back;
 
@@ -119,6 +115,7 @@
             final_handle_section_opening( name_of_opening_section );
         } else {}
         return parsing_success;
+ */
     }
     
     void final_handle_section_opening( std::string& name_of_opening_section ) {
@@ -152,6 +149,8 @@
     }
 private:
     bool handle_section_closing( std::string& s, pure_options& /* factual_obtained_options */ ) {
+
+ /*
         using boost::spirit::qi::_1;
         using boost::phoenix::push_back;
 
@@ -169,6 +168,7 @@
             final_handle_section_closing( name_of_closing_section );
         } else {}
         return parsing_success;
+ */
     }
     
     void final_handle_section_closing( std::string& name_of_closing_section ) {
@@ -198,6 +198,8 @@
     }
 private:
     bool handle_option( std::string& s, pure_options& factual_obtained_options ) {
+
+ /*
         using boost::spirit::qi::_1;
         using boost::phoenix::push_back;
 
@@ -222,6 +224,7 @@
             final_handle_option( option_name, option_value, factual_obtained_options );
         } else {}
         return parsing_success;
+ */
     }
 
     void final_handle_option( const std::string& option_name


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk