Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r58105 - in trunk/boost/spirit: home/karma home/karma/auto home/karma/detail home/karma/stream home/karma/stream/detail home/qi home/qi/detail home/qi/stream home/qi/stream/detail include
From: hartmut.kaiser_at_[hidden]
Date: 2009-12-02 21:43:56


Author: hkaiser
Date: 2009-12-02 21:43:53 EST (Wed, 02 Dec 2009)
New Revision: 58105
URL: http://svn.boost.org/trac/boost/changeset/58105

Log:
Spirit: added auto based overloads for API functions where possible
Added:
   trunk/boost/spirit/home/karma/delimit_flag.hpp (contents, props changed)
   trunk/boost/spirit/home/karma/detail/generate.hpp (contents, props changed)
   trunk/boost/spirit/home/karma/detail/generate_auto.hpp (contents, props changed)
   trunk/boost/spirit/home/karma/format_auto.hpp (contents, props changed)
   trunk/boost/spirit/home/karma/stream/detail/format_manip_auto.hpp (contents, props changed)
   trunk/boost/spirit/home/qi/detail/parse.hpp (contents, props changed)
   trunk/boost/spirit/home/qi/detail/parse_auto.hpp (contents, props changed)
   trunk/boost/spirit/home/qi/match.hpp (contents, props changed)
   trunk/boost/spirit/home/qi/match_auto.hpp (contents, props changed)
   trunk/boost/spirit/home/qi/skip_flag.hpp (contents, props changed)
   trunk/boost/spirit/home/qi/stream/detail/match_manip_auto.hpp (contents, props changed)
   trunk/boost/spirit/include/karma_format_auto.hpp (contents, props changed)
   trunk/boost/spirit/include/karma_generate_auto.hpp (contents, props changed)
   trunk/boost/spirit/include/qi_match_auto.hpp (contents, props changed)
   trunk/boost/spirit/include/qi_parse_auto.hpp (contents, props changed)
Text files modified:
   trunk/boost/spirit/home/karma/auto.hpp | 1
   trunk/boost/spirit/home/karma/auto/meta_create.hpp | 11 ++-
   trunk/boost/spirit/home/karma/generate.hpp | 97 +++--------------------------------
   trunk/boost/spirit/home/karma/stream/detail/format_manip.hpp | 110 +++++++++++++++++++++++++++++++++++----
   trunk/boost/spirit/home/karma/stream/format_manip.hpp | 59 ++++++++++----------
   trunk/boost/spirit/home/karma/stream/format_manip_attr.hpp | 12 ++--
   trunk/boost/spirit/home/qi/auto.hpp | 1
   trunk/boost/spirit/home/qi/parse.hpp | 49 ++--------------
   trunk/boost/spirit/home/qi/stream/detail/match_manip.hpp | 106 ++++++++++++++++++++++++++++++++++---
   trunk/boost/spirit/home/qi/stream/match_manip.hpp | 44 ++++++---------
   trunk/boost/spirit/home/qi/stream/match_manip_attr.hpp | 13 ++--
   trunk/boost/spirit/include/karma_format.hpp | 2
   trunk/boost/spirit/include/qi_match.hpp | 2
   13 files changed, 281 insertions(+), 226 deletions(-)

Modified: trunk/boost/spirit/home/karma/auto.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/auto.hpp (original)
+++ trunk/boost/spirit/home/karma/auto.hpp 2009-12-02 21:43:53 EST (Wed, 02 Dec 2009)
@@ -11,5 +11,6 @@
 #endif
 
 #include <boost/spirit/home/karma/auto/auto.hpp>
+#include <boost/spirit/home/karma/detail/generate_auto.hpp>
 
 #endif

Modified: trunk/boost/spirit/home/karma/auto/meta_create.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/auto/meta_create.hpp (original)
+++ trunk/boost/spirit/home/karma/auto/meta_create.hpp 2009-12-02 21:43:53 EST (Wed, 02 Dec 2009)
@@ -159,11 +159,12 @@
 
     template <typename T>
     struct meta_create_impl<T
- , typename enable_if_c<
- traits::is_container<T>::value &&
- !traits::is_string<T>::value &&
- !fusion::traits::is_sequence<T>::value
- >::type>
+ , typename enable_if<
+ mpl::and_<
+ traits::is_container<T>
+ , mpl::not_<traits::is_string<T> >
+ , mpl::not_<fusion::traits::is_sequence<T> >
+ > >::type>
       : meta_create_container<T> {};
 
     template <typename T>

Added: trunk/boost/spirit/home/karma/delimit_flag.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/karma/delimit_flag.hpp 2009-12-02 21:43:53 EST (Wed, 02 Dec 2009)
@@ -0,0 +1,27 @@
+// Copyright (c) 2001-2009 Hartmut Kaiser
+//
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#if !defined(BOOST_SPIRIT_KARMA_DELIMIT_FLAG_DEC_02_2009_1201PM)
+#define BOOST_SPIRIT_KARMA_DELIMIT_FLAG_DEC_02_2009_1201PM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/support/detail/scoped_enum_emulation.hpp>
+
+namespace boost { namespace spirit { namespace karma
+{
+ ///////////////////////////////////////////////////////////////////////////
+ BOOST_SCOPED_ENUM_START(delimit_flag)
+ {
+ predelimit, // force predelimiting in generate_delimited()
+ dont_predelimit // inhibit predelimiting in generate_delimited()
+ };
+ BOOST_SCOPED_ENUM_END
+}}}
+
+#endif
+

Added: trunk/boost/spirit/home/karma/detail/generate.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/karma/detail/generate.hpp 2009-12-02 21:43:53 EST (Wed, 02 Dec 2009)
@@ -0,0 +1,131 @@
+// Copyright (c) 2001-2009 Hartmut Kaiser
+//
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#if !defined(BOOST_SPIRIT_KARMA_DETAIL_GENERATE_FEB_20_2007_0959AM)
+#define BOOST_SPIRIT_KARMA_DETAIL_GENERATE_FEB_20_2007_0959AM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/karma/meta_compiler.hpp>
+#include <boost/spirit/home/karma/delimit_out.hpp>
+#include <boost/spirit/home/karma/delimit_flag.hpp>
+#include <boost/spirit/home/karma/detail/output_iterator.hpp>
+#include <boost/spirit/home/support/unused.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/mpl/bool.hpp>
+
+namespace boost { namespace spirit { namespace karma { namespace detail
+{
+ ///////////////////////////////////////////////////////////////////////////
+ template <typename Expr, typename Enable = void>
+ struct generate
+ {
+ // Report invalid expression error as early as possible.
+ // If you got an error_invalid_expression error message here,
+ // then the expression (Expr) is not a valid spirit karma expression.
+ // Did you intend to use the auto_ facilities while forgetting to
+ // #include <boost/spirit/include/karma_auto.hpp>?
+ BOOST_SPIRIT_ASSERT_MATCH(karma::domain, Expr);
+ };
+
+ template <typename Expr>
+ struct generate<Expr
+ , typename enable_if<traits::matches<karma::domain, Expr> >::type>
+ {
+ template <typename OutputIterator>
+ static bool call(
+ OutputIterator& target_sink
+ , Expr const& expr)
+ {
+ typedef traits::properties_of<
+ typename result_of::compile<karma::domain, Expr>::type
+ > properties;
+
+ // wrap user supplied iterator into our own output iterator
+ output_iterator<OutputIterator
+ , mpl::int_<properties::value> > sink(target_sink);
+ return compile<karma::domain>(expr).
+ generate(sink, unused, unused, unused);
+ }
+
+ template <typename OutputIterator, typename Properties>
+ static bool call(
+ detail::output_iterator<OutputIterator, Properties>& sink
+ , Expr const& expr)
+ {
+ return compile<karma::domain>(expr).
+ generate(sink, unused, unused, unused);
+ }
+ };
+
+ ///////////////////////////////////////////////////////////////////////////
+ template <typename Expr, typename Enable = void>
+ struct generate_delimited
+ {
+ // Report invalid expression error as early as possible.
+ // If you got an error_invalid_expression error message here,
+ // then the expression (Expr) is not a valid spirit karma expression.
+ // Did you intend to use the auto_ facilities while forgetting to
+ // #include <boost/spirit/include/karma_auto.hpp>?
+ BOOST_SPIRIT_ASSERT_MATCH(karma::domain, Expr);
+ };
+
+ template <typename Expr>
+ struct generate_delimited<Expr
+ , typename enable_if<traits::matches<karma::domain, Expr> >::type>
+ {
+ template <typename OutputIterator, typename Delimiter>
+ static bool call(
+ OutputIterator& target_sink
+ , Expr const& expr
+ , Delimiter const& delimiter
+ , BOOST_SCOPED_ENUM(delimit_flag) pre_delimit)
+ {
+ typedef traits::properties_of<
+ typename result_of::compile<karma::domain, Expr>::type
+ > properties;
+ typedef traits::properties_of<
+ typename result_of::compile<karma::domain, Delimiter>::type
+ > delimiter_properties;
+
+ // wrap user supplied iterator into our own output iterator
+ detail::output_iterator<OutputIterator
+ , mpl::int_<properties::value | delimiter_properties::value>
+ > sink(target_sink);
+ return call(sink, expr, delimiter, pre_delimit);
+ }
+
+ template <typename OutputIterator, typename Properties
+ , typename Delimiter>
+ static bool call(
+ detail::output_iterator<OutputIterator, Properties>& sink
+ , Expr const& expr
+ , Delimiter const& delimiter
+ , BOOST_SCOPED_ENUM(delimit_flag) pre_delimit)
+ {
+ // Report invalid expression error as early as possible.
+ // If you got an error_invalid_expression error message here,
+ // then the delimiter is not a valid spirit karma expression.
+ BOOST_SPIRIT_ASSERT_MATCH(karma::domain, Delimiter);
+
+ typename result_of::compile<karma::domain, Delimiter>::type const
+ delimiter_ = compile<karma::domain>(delimiter);
+
+ if (pre_delimit == delimit_flag::predelimit &&
+ !karma::delimit_out(sink, delimiter_))
+ {
+ return false;
+ }
+ return compile<karma::domain>(expr).
+ generate(sink, unused, delimiter_, unused);
+ }
+ };
+
+}}}}
+
+#endif
+

Added: trunk/boost/spirit/home/karma/detail/generate_auto.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/karma/detail/generate_auto.hpp 2009-12-02 21:43:53 EST (Wed, 02 Dec 2009)
@@ -0,0 +1,53 @@
+// Copyright (c) 2001-2009 Hartmut Kaiser
+//
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#if !defined(BOOST_SPIRIT_KARMA_DETAIL_GENERATE_AUTO_DEC_01_2009_0743PM)
+#define BOOST_SPIRIT_KARMA_DETAIL_GENERATE_AUTO_DEC_01_2009_0743PM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/karma/detail/generate.hpp>
+#include <boost/spirit/home/karma/auto/create_generator.hpp>
+#include <boost/utility/enable_if.hpp>
+
+namespace boost { namespace spirit { namespace karma { namespace detail
+{
+ ///////////////////////////////////////////////////////////////////////////
+ template <typename Expr>
+ struct generate<Expr
+ , typename enable_if<traits::meta_create_exists<karma::domain, Expr> >::type>
+ {
+ template <typename OutputIterator>
+ static bool call(
+ OutputIterator& sink
+ , Expr const& expr)
+ {
+ return karma::generate(sink, create_generator<Expr>(), expr);
+ }
+ };
+
+ ///////////////////////////////////////////////////////////////////////////
+ template <typename Expr>
+ struct generate_delimited<Expr
+ , typename enable_if<traits::meta_create_exists<karma::domain, Expr> >::type>
+ {
+ template <typename OutputIterator, typename Delimiter>
+ static bool call(
+ OutputIterator& sink
+ , Expr const& expr
+ , Delimiter const& delimiter
+ , BOOST_SCOPED_ENUM(delimit_flag) pre_delimit)
+ {
+ return karma::generate_delimited(
+ sink, create_generator<Expr>(), delimiter, pre_delimit, expr);
+ }
+ };
+
+}}}}
+
+#endif
+

Added: trunk/boost/spirit/home/karma/format_auto.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/karma/format_auto.hpp 2009-12-02 21:43:53 EST (Wed, 02 Dec 2009)
@@ -0,0 +1,16 @@
+// Copyright (c) 2001-2009 Hartmut Kaiser
+//
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#if !defined(BOOST_SPIRIT_KARMA_FORMAT_AUTO_DEC_02_2009_1248PM)
+#define BOOST_SPIRIT_KARMA_FORMAT_AUTO_DEC_02_2009_1248PM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/karma/stream/format_manip.hpp>
+#include <boost/spirit/home/karma/stream/detail/format_manip_auto.hpp>
+
+#endif

Modified: trunk/boost/spirit/home/karma/generate.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/generate.hpp (original)
+++ trunk/boost/spirit/home/karma/generate.hpp 2009-12-02 21:43:53 EST (Wed, 02 Dec 2009)
@@ -3,64 +3,25 @@
 // Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 
-#if !defined(BOOST_SPIRIT_KARMA_GENERATE_FEB_20_2007_0959AM)
-#define BOOST_SPIRIT_KARMA_GENERATE_FEB_20_2007_0959AM
+#if !defined(BOOST_SPIRIT_KARMA_GENERATE_DEC_01_2009_0734PM)
+#define BOOST_SPIRIT_KARMA_GENERATE_DEC_01_2009_0734PM
 
 #if defined(_MSC_VER)
 #pragma once
 #endif
 
-#include <boost/spirit/home/karma/meta_compiler.hpp>
-#include <boost/spirit/home/karma/delimit_out.hpp>
-#include <boost/spirit/home/karma/detail/output_iterator.hpp>
-#include <boost/spirit/home/support/unused.hpp>
-#include <boost/spirit/home/support/detail/scoped_enum_emulation.hpp>
-#include <boost/mpl/assert.hpp>
-#include <boost/mpl/bool.hpp>
+#include <boost/spirit/home/karma/detail/generate.hpp>
 
 namespace boost { namespace spirit { namespace karma
 {
     ///////////////////////////////////////////////////////////////////////////
- BOOST_SCOPED_ENUM_START(delimit_flag)
- {
- predelimit, // force predelimiting in generate_delimited()
- dont_predelimit // inhibit predelimiting in generate_delimited()
- };
- BOOST_SCOPED_ENUM_END
-
- ///////////////////////////////////////////////////////////////////////////
     template <typename OutputIterator, typename Expr>
     inline bool
     generate(
- OutputIterator& target_sink
- , Expr const& expr)
- {
- // Report invalid expression error as early as possible.
- // If you got an error_invalid_expression error message here,
- // then the expression (expr) is not a valid spirit karma expression.
- BOOST_SPIRIT_ASSERT_MATCH(karma::domain, Expr);
-
- typedef traits::properties_of<
- typename result_of::compile<karma::domain, Expr>::type
- > properties;
-
- // wrap user supplied iterator into our own output iterator
- detail::output_iterator<OutputIterator
- , mpl::int_<properties::value> > sink(target_sink);
- return compile<karma::domain>(expr).generate(sink, unused, unused, unused);
- }
-
- template <typename OutputIterator, typename Properties, typename Expr>
- inline bool
- generate(
- detail::output_iterator<OutputIterator, Properties>& sink
+ OutputIterator& sink
       , Expr const& expr)
     {
- // Report invalid expression error as early as possible.
- // If you got an error_invalid_expression error message here,
- // then the expression (expr) is not a valid spirit karma expression.
- BOOST_SPIRIT_ASSERT_MATCH(karma::domain, Expr);
- return compile<karma::domain>(expr).generate(sink, unused, unused, unused);
+ return detail::generate<Expr>::call(sink, expr);
     }
 
     ///////////////////////////////////////////////////////////////////////////
@@ -102,57 +63,17 @@
     }
 
     ///////////////////////////////////////////////////////////////////////////
- template <typename OutputIterator, typename Properties, typename Expr
- , typename Delimiter>
- inline bool
- generate_delimited(
- detail::output_iterator<OutputIterator, Properties>& sink
- , Expr const& expr
- , Delimiter const& delimiter
- , BOOST_SCOPED_ENUM(delimit_flag) pre_delimit =
- delimit_flag::dont_predelimit)
- {
- // Report invalid expression error as early as possible.
- // If you got an error_invalid_expression error message here,
- // then either the expression (expr) or skipper is not a valid
- // spirit karma expression.
- BOOST_SPIRIT_ASSERT_MATCH(karma::domain, Expr);
- BOOST_SPIRIT_ASSERT_MATCH(karma::domain, Delimiter);
-
- typename result_of::compile<karma::domain, Delimiter>::type const
- delimiter_ = compile<karma::domain>(delimiter);
-
- if (pre_delimit == delimit_flag::predelimit &&
- !karma::delimit_out(sink, delimiter_))
- {
- return false;
- }
-
- return compile<karma::domain>(expr).
- generate(sink, unused, delimiter_, unused);
- }
-
     template <typename OutputIterator, typename Expr, typename Delimiter>
     inline bool
     generate_delimited(
- OutputIterator& target_sink
+ OutputIterator& sink
       , Expr const& expr
       , Delimiter const& delimiter
       , BOOST_SCOPED_ENUM(delimit_flag) pre_delimit =
             delimit_flag::dont_predelimit)
     {
- typedef traits::properties_of<
- typename result_of::compile<karma::domain, Expr>::type
- > properties;
- typedef traits::properties_of<
- typename result_of::compile<karma::domain, Delimiter>::type
- > delimiter_properties;
-
- // wrap user supplied iterator into our own output iterator
- detail::output_iterator<OutputIterator
- , mpl::int_<properties::value | delimiter_properties::value>
- > sink(target_sink);
- return generate_delimited(sink, expr, delimiter, pre_delimit);
+ return detail::generate_delimited<Expr>::call(
+ sink, expr, delimiter, pre_delimit);
     }
 
     ///////////////////////////////////////////////////////////////////////////
@@ -181,7 +102,6 @@
         {
             return false;
         }
-
         return compile<karma::domain>(expr).
             generate(sink, unused, delimiter_, attr);
     }
@@ -211,6 +131,7 @@
         return generate_delimited(sink, expr, delimiter, pre_delimit, attr);
     }
 
+ ///////////////////////////////////////////////////////////////////////////
     template <typename OutputIterator, typename Expr, typename Attribute
       , typename Delimiter>
     inline bool

Modified: trunk/boost/spirit/home/karma/stream/detail/format_manip.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/stream/detail/format_manip.hpp (original)
+++ trunk/boost/spirit/home/karma/stream/detail/format_manip.hpp 2009-12-02 21:43:53 EST (Wed, 02 Dec 2009)
@@ -20,7 +20,8 @@
 namespace boost { namespace spirit { namespace karma { namespace detail
 {
     ///////////////////////////////////////////////////////////////////////////
- template <typename Expr, typename CopyAttribute = mpl::false_
+ template <typename Expr
+ , typename CopyExpr = mpl::false_, typename CopyAttr = mpl::false_
       , typename Delimiter = unused_type, typename Attribute = unused_type>
     struct format_manip
     {
@@ -42,7 +43,7 @@
     };
 
     template <typename Expr, typename Delimiter, typename Attribute>
- struct format_manip<Expr, mpl::true_, Delimiter, Attribute>
+ struct format_manip<Expr, mpl::false_, mpl::true_, Delimiter, Attribute>
     {
         format_manip(Expr const& xpr, Delimiter const& d, Attribute const& a)
           : expr(xpr), delim(d), pre(delimit_flag::dont_predelimit), attr(a) {}
@@ -61,11 +62,93 @@
         format_manip& operator= (format_manip const&);
     };
 
+ template <typename Expr, typename Delimiter, typename Attribute>
+ struct format_manip<Expr, mpl::true_, mpl::false_, Delimiter, Attribute>
+ {
+ format_manip(Expr const& xpr, Delimiter const& d, Attribute const& a)
+ : expr(xpr), delim(d), pre(delimit_flag::dont_predelimit), attr(a) {}
+
+ format_manip(Expr const& xpr, Delimiter const& d
+ , BOOST_SCOPED_ENUM(delimit_flag) pre_delimit, Attribute const& a)
+ : expr(xpr), delim(d), pre(pre_delimit), attr(a) {}
+
+ Expr expr;
+ Delimiter const& delim;
+ BOOST_SCOPED_ENUM(delimit_flag) const pre;
+ Attribute const& attr;
+
+ private:
+ // silence MSVC warning C4512: assignment operator could not be generated
+ format_manip& operator= (format_manip const&);
+ };
+
+ template <typename Expr, typename Delimiter, typename Attribute>
+ struct format_manip<Expr, mpl::true_, mpl::true_, Delimiter, Attribute>
+ {
+ BOOST_SPIRIT_ASSERT_MSG(false, error_invalid_should_not_happen, ());
+ };
+
+ ///////////////////////////////////////////////////////////////////////////
+ template <typename Expr, typename Enable = void>
+ struct format
+ {
+ // Report invalid expression error as early as possible.
+ // If you got an error_invalid_expression error message here,
+ // then the expression (Expr) is not a valid spirit karma expression.
+ // Did you intend to use the auto_ facilities while forgetting to
+ // #include <boost/spirit/include/karma_format_auto.hpp>?
+ BOOST_SPIRIT_ASSERT_MATCH(karma::domain, Expr);
+ };
+
+ template <typename Expr>
+ struct format<Expr
+ , typename enable_if<traits::matches<karma::domain, Expr> >::type>
+ {
+ typedef format_manip<Expr> type;
+
+ static type call(Expr const& expr)
+ {
+ return type(expr, unused, unused);
+ }
+ };
+
     ///////////////////////////////////////////////////////////////////////////
- template<typename Char, typename Traits, typename Expr, typename Copy>
+ template <typename Expr, typename Delimiter, typename Enable = void>
+ struct format_delimited
+ {
+ // Report invalid expression error as early as possible.
+ // If you got an error_invalid_expression error message here,
+ // then the expression (Expr) is not a valid spirit karma expression.
+ // Did you intend to use the auto_ facilities while forgetting to
+ // #include <boost/spirit/include/karma_format_auto.hpp>?
+ BOOST_SPIRIT_ASSERT_MATCH(karma::domain, Expr);
+ };
+
+ template <typename Expr, typename Delimiter>
+ struct format_delimited<Expr, Delimiter
+ , typename enable_if<traits::matches<karma::domain, Expr> >::type>
+ {
+ typedef format_manip<Expr, mpl::false_, mpl::false_, Delimiter> type;
+
+ static type call(
+ Expr const& expr
+ , Delimiter const& delimiter
+ , BOOST_SCOPED_ENUM(delimit_flag) pre_delimit)
+ {
+ // Report invalid expression error as early as possible.
+ // If you got an error_invalid_expression error message here,
+ // then the delimiter is not a valid spirit karma expression.
+ BOOST_SPIRIT_ASSERT_MATCH(karma::domain, Delimiter);
+ return type(expr, delimiter, pre_delimit, unused);
+ }
+ };
+
+ ///////////////////////////////////////////////////////////////////////////
+ template<typename Char, typename Traits, typename Expr
+ , typename CopyExpr, typename CopyAttr>
     inline std::basic_ostream<Char, Traits> &
     operator<< (std::basic_ostream<Char, Traits> &os
- , format_manip<Expr, Copy> const& fm)
+ , format_manip<Expr, CopyExpr, CopyAttr> const& fm)
     {
         karma::ostream_iterator<Char, Char, Traits> sink(os);
         if (!karma::generate (sink, fm.expr))
@@ -76,11 +159,11 @@
     }
 
     ///////////////////////////////////////////////////////////////////////////
- template<typename Char, typename Traits, typename Expr, typename Copy
- , typename Attribute>
+ template<typename Char, typename Traits, typename Expr
+ , typename CopyExpr, typename CopyAttr, typename Attribute>
     inline std::basic_ostream<Char, Traits> &
     operator<< (std::basic_ostream<Char, Traits> &os
- , format_manip<Expr, Copy, unused_type, Attribute> const& fm)
+ , format_manip<Expr, CopyExpr, CopyAttr, unused_type, Attribute> const& fm)
     {
         karma::ostream_iterator<Char, Char, Traits> sink(os);
         if (!karma::generate(sink, fm.expr, fm.attr))
@@ -90,11 +173,11 @@
         return os;
     }
 
- template<typename Char, typename Traits, typename Expr, typename Copy
- , typename Delimiter>
+ template<typename Char, typename Traits, typename Expr
+ , typename CopyExpr, typename CopyAttr, typename Delimiter>
     inline std::basic_ostream<Char, Traits> &
     operator<< (std::basic_ostream<Char, Traits> &os
- , format_manip<Expr, Copy, Delimiter> const& fm)
+ , format_manip<Expr, CopyExpr, CopyAttr, Delimiter> const& fm)
     {
         karma::ostream_iterator<Char, Char, Traits> sink(os);
         if (!karma::generate_delimited(sink, fm.expr, fm.delim, fm.pre))
@@ -105,11 +188,12 @@
     }
 
     ///////////////////////////////////////////////////////////////////////////
- template<typename Char, typename Traits, typename Expr, typename Copy
- , typename Delimiter, typename Attribute>
+ template<typename Char, typename Traits, typename Expr
+ , typename CopyExpr, typename CopyAttr, typename Delimiter
+ , typename Attribute>
     inline std::basic_ostream<Char, Traits> &
     operator<< (std::basic_ostream<Char, Traits> &os
- , format_manip<Expr, Copy, Delimiter, Attribute> const& fm)
+ , format_manip<Expr, CopyExpr, CopyAttr, Delimiter, Attribute> const& fm)
     {
         karma::ostream_iterator<Char, Char, Traits> sink(os);
         if (!karma::generate_delimited(sink, fm.expr, fm.delim, fm.pre, fm.attr))

Added: trunk/boost/spirit/home/karma/stream/detail/format_manip_auto.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/karma/stream/detail/format_manip_auto.hpp 2009-12-02 21:43:53 EST (Wed, 02 Dec 2009)
@@ -0,0 +1,56 @@
+// Copyright (c) 2001-2009 Hartmut Kaiser
+//
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#if !defined(BOOST_SPIRIT_KARMA_FORMAT_MANIP_AUTO_DEC_02_2009_1246PM)
+#define BOOST_SPIRIT_KARMA_FORMAT_MANIP_AUTO_DEC_02_2009_1246PM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/karma/stream/detail/format_manip.hpp>
+#include <boost/spirit/home/karma/auto/create_generator.hpp>
+#include <boost/utility/enable_if.hpp>
+
+///////////////////////////////////////////////////////////////////////////////
+namespace boost { namespace spirit { namespace karma { namespace detail
+{
+ ///////////////////////////////////////////////////////////////////////////
+ template <typename Expr>
+ struct format<Expr
+ , typename enable_if<traits::meta_create_exists<karma::domain, Expr> >::type>
+ {
+ typedef typename result_of::create_generator<Expr>::type expr_type;
+ typedef format_manip<
+ expr_type, mpl::true_, mpl::false_, unused_type, Expr
+ > type;
+
+ static type call(Expr const& expr)
+ {
+ return type(create_generator<Expr>(), unused, expr);
+ }
+ };
+
+ ///////////////////////////////////////////////////////////////////////////
+ template <typename Expr, typename Delimiter>
+ struct format_delimited<Expr, Delimiter
+ , typename enable_if<traits::meta_create_exists<karma::domain, Expr> >::type>
+ {
+ typedef typename result_of::create_generator<Expr>::type expr_type;
+ typedef format_manip<
+ expr_type, mpl::true_, mpl::false_, Delimiter, Expr
+ > type;
+
+ static type call(Expr const& expr
+ , Delimiter const& delimiter
+ , BOOST_SCOPED_ENUM(delimit_flag) pre_delimit)
+ {
+ return type(create_generator<Expr>(), delimiter, pre_delimit, expr);
+ }
+ };
+
+}}}}
+
+#endif

Modified: trunk/boost/spirit/home/karma/stream/format_manip.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/stream/format_manip.hpp (original)
+++ trunk/boost/spirit/home/karma/stream/format_manip.hpp 2009-12-02 21:43:53 EST (Wed, 02 Dec 2009)
@@ -21,19 +21,17 @@
 {
     ///////////////////////////////////////////////////////////////////////////
     template <typename Expr>
- inline detail::format_manip<Expr>
- format(Expr const& xpr)
+ inline typename detail::format<Expr>::type
+ format(Expr const& expr)
     {
- // Report invalid expression error as early as possible.
- // If you got an error_invalid_expression error message here,
- // then the expression (expr) is not a valid spirit karma expression.
- BOOST_SPIRIT_ASSERT_MATCH(karma::domain, Expr);
- return karma::detail::format_manip<Expr>(xpr, unused, unused);
+ return detail::format<Expr>::call(expr);
     }
 
     template <typename Expr, typename Attribute>
- inline detail::format_manip<Expr, mpl::false_, unused_type, Attribute>
- format(Expr const& xpr, Attribute const& attr)
+ inline detail::format_manip<Expr, mpl::false_, mpl::false_, unused_type, Attribute>
+ format(
+ Expr const& expr
+ , Attribute const& attr)
     {
         using karma::detail::format_manip;
 
@@ -41,31 +39,29 @@
         // If you got an error_invalid_expression error message here,
         // then the expression (expr) is not a valid spirit karma expression.
         BOOST_SPIRIT_ASSERT_MATCH(karma::domain, Expr);
- return format_manip<Expr, mpl::false_, unused_type, Attribute>(
- xpr, unused, attr);
+ return format_manip<Expr, mpl::false_, mpl::false_, unused_type, Attribute>(
+ expr, unused, attr);
     }
 
     ///////////////////////////////////////////////////////////////////////////
     template <typename Expr, typename Delimiter>
- inline detail::format_manip<Expr, mpl::false_, Delimiter>
- format_delimited(Expr const& xpr, Delimiter const& d
- , BOOST_SCOPED_ENUM(delimit_flag) pre_delimit = delimit_flag::dont_predelimit)
+ inline typename detail::format_delimited<Expr, Delimiter>::type
+ format_delimited(
+ Expr const& expr
+ , Delimiter const& d
+ , BOOST_SCOPED_ENUM(delimit_flag) pre_delimit =
+ delimit_flag::dont_predelimit)
     {
- using karma::detail::format_manip;
-
- // Report invalid expression error as early as possible.
- // If you got an error_invalid_expression error message here,
- // then the expression (expr) is not a valid spirit karma expression.
- BOOST_SPIRIT_ASSERT_MATCH(karma::domain, Expr);
- BOOST_SPIRIT_ASSERT_MATCH(karma::domain, Delimiter);
- return format_manip<Expr, mpl::false_, Delimiter>(
- xpr, d, pre_delimit, unused);
+ return detail::format_delimited<Expr, Delimiter>::call(expr, d, pre_delimit);
     }
 
     template <typename Expr, typename Delimiter, typename Attribute>
- inline detail::format_manip<Expr, mpl::false_, Delimiter, Attribute>
- format_delimited(Expr const& xpr, Delimiter const& d
- , BOOST_SCOPED_ENUM(delimit_flag) pre_delimit, Attribute const& attr)
+ inline detail::format_manip<Expr, mpl::false_, mpl::false_, Delimiter, Attribute>
+ format_delimited(
+ Expr const& xpr
+ , Delimiter const& d
+ , BOOST_SCOPED_ENUM(delimit_flag) pre_delimit
+ , Attribute const& attr)
     {
         using karma::detail::format_manip;
 
@@ -74,13 +70,16 @@
         // then the expression (expr) is not a valid spirit karma expression.
         BOOST_SPIRIT_ASSERT_MATCH(karma::domain, Expr);
         BOOST_SPIRIT_ASSERT_MATCH(karma::domain, Delimiter);
- return format_manip<Expr, mpl::false_, Delimiter, Attribute>(
+ return format_manip<Expr, mpl::false_, mpl::false_, Delimiter, Attribute>(
             xpr, d, pre_delimit, attr);
     }
 
     template <typename Expr, typename Delimiter, typename Attribute>
- inline detail::format_manip<Expr, mpl::false_, Delimiter, Attribute>
- format_delimited(Expr const& xpr, Delimiter const& d, Attribute const& attr)
+ inline detail::format_manip<Expr, mpl::false_, mpl::false_, Delimiter, Attribute>
+ format_delimited(
+ Expr const& xpr
+ , Delimiter const& d
+ , Attribute const& attr)
     {
         using karma::detail::format_manip;
 
@@ -89,7 +88,7 @@
         // then the expression (expr) is not a valid spirit karma expression.
         BOOST_SPIRIT_ASSERT_MATCH(karma::domain, Expr);
         BOOST_SPIRIT_ASSERT_MATCH(karma::domain, Delimiter);
- return format_manip<Expr, mpl::false_, Delimiter, Attribute>(
+ return format_manip<Expr, mpl::false_, mpl::false_, Delimiter, Attribute>(
             xpr, d, delimit_flag::dont_predelimit, attr);
     }
 

Modified: trunk/boost/spirit/home/karma/stream/format_manip_attr.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/stream/format_manip_attr.hpp (original)
+++ trunk/boost/spirit/home/karma/stream/format_manip_attr.hpp 2009-12-02 21:43:53 EST (Wed, 02 Dec 2009)
@@ -39,7 +39,7 @@
 {
     ///////////////////////////////////////////////////////////////////////////
     template <typename Expr, BOOST_PP_ENUM_PARAMS(N, typename A)>
- inline detail::format_manip<Expr, mpl::true_, unused_type
+ inline detail::format_manip<Expr, mpl::false_, mpl::true_, unused_type
       , fusion::vector<
             BOOST_PP_ENUM(N, BOOST_SPIRIT_KARMA_ATTRIBUTE_REFERENCE, A)
> >
@@ -57,14 +57,14 @@
> vector_type;
 
         vector_type attr (BOOST_PP_ENUM_PARAMS(N, attr));
- return format_manip<Expr, mpl::true_, unused_type, vector_type>(
+ return format_manip<Expr, mpl::false_, mpl::true_, unused_type, vector_type>(
             xpr, unused, attr);
     }
 
     ///////////////////////////////////////////////////////////////////////////
     template <typename Expr, typename Delimiter
       , BOOST_PP_ENUM_PARAMS(N, typename A)>
- inline detail::format_manip<Expr, mpl::true_, Delimiter
+ inline detail::format_manip<Expr, mpl::false_, mpl::true_, Delimiter
       , fusion::vector<
             BOOST_PP_ENUM(N, BOOST_SPIRIT_KARMA_ATTRIBUTE_REFERENCE, A)
> >
@@ -85,13 +85,13 @@
> vector_type;
 
         vector_type attr (BOOST_PP_ENUM_PARAMS(N, attr));
- return format_manip<Expr, mpl::true_, Delimiter, vector_type>(
+ return format_manip<Expr, mpl::false_, mpl::true_, Delimiter, vector_type>(
             xpr, d, pre_delimit, attr);
     }
 
     template <typename Expr, typename Delimiter
       , BOOST_PP_ENUM_PARAMS(N, typename A)>
- inline detail::format_manip<Expr, mpl::true_, Delimiter
+ inline detail::format_manip<Expr, mpl::false_, mpl::true_, Delimiter
       , fusion::vector<
             BOOST_PP_ENUM(N, BOOST_SPIRIT_KARMA_ATTRIBUTE_REFERENCE, A)
> >
@@ -111,7 +111,7 @@
> vector_type;
 
         vector_type attr (BOOST_PP_ENUM_PARAMS(N, attr));
- return format_manip<Expr, mpl::true_, Delimiter, vector_type>(
+ return format_manip<Expr, mpl::false_, mpl::true_, Delimiter, vector_type>(
             xpr, d, delimit_flag::dont_predelimit, attr);
     }
 

Modified: trunk/boost/spirit/home/qi/auto.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/auto.hpp (original)
+++ trunk/boost/spirit/home/qi/auto.hpp 2009-12-02 21:43:53 EST (Wed, 02 Dec 2009)
@@ -13,5 +13,6 @@
 #endif
 
 #include <boost/spirit/home/qi/auto/auto.hpp>
+#include <boost/spirit/home/qi/detail/parse_auto.hpp>
 
 #endif

Added: trunk/boost/spirit/home/qi/detail/parse.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/qi/detail/parse.hpp 2009-12-02 21:43:53 EST (Wed, 02 Dec 2009)
@@ -0,0 +1,97 @@
+/*=============================================================================
+ Copyright (c) 2001-2009 Hartmut Kaiser
+
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+=============================================================================*/
+#if !defined(BOOST_SPIRIT_DETAIL_PARSE_DEC_02_2009_0411PM)
+#define BOOST_SPIRIT_DETAIL_PARSE_DEC_02_2009_0411PM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/qi/meta_compiler.hpp>
+#include <boost/spirit/home/qi/skip_flag.hpp>
+#include <boost/spirit/home/qi/skip_over.hpp>
+#include <boost/spirit/home/support/unused.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/mpl/bool.hpp>
+
+namespace boost { namespace spirit { namespace qi { namespace detail
+{
+ ///////////////////////////////////////////////////////////////////////////
+ template <typename Expr, typename Enable = void>
+ struct parse
+ {
+ // Report invalid expression error as early as possible.
+ // If you got an error_invalid_expression error message here,
+ // then the expression (expr) is not a valid spirit qi expression.
+ // Did you intend to use the auto_ facilities while forgetting to
+ // #include <boost/spirit/include/qi_auto.hpp>?
+ BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Expr);
+ };
+
+ template <typename Expr>
+ struct parse<Expr
+ , typename enable_if<traits::matches<qi::domain, Expr> >::type>
+ {
+ template <typename Iterator>
+ static bool call(
+ Iterator& first
+ , Iterator last
+ , Expr const& expr)
+ {
+ return compile<qi::domain>(expr).parse(
+ first, last, unused, unused, unused);
+ }
+ };
+
+ ///////////////////////////////////////////////////////////////////////////
+ template <typename Expr, typename Enable = void>
+ struct phrase_parse
+ {
+ // Report invalid expression error as early as possible.
+ // If you got an error_invalid_expression error message here,
+ // then the expression (expr) is not a valid spirit qi expression.
+ // Did you intend to use the auto_ facilities while forgetting to
+ // #include <boost/spirit/include/qi_auto.hpp>?
+ BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Expr);
+ };
+
+ template <typename Expr>
+ struct phrase_parse<Expr
+ , typename enable_if<traits::matches<qi::domain, Expr> >::type>
+ {
+ template <typename Iterator, typename Skipper>
+ static bool call(
+ Iterator& first
+ , Iterator last
+ , Expr const& expr
+ , Skipper const& skipper
+ , BOOST_SCOPED_ENUM(skip_flag) post_skip)
+ {
+ // Report invalid expression error as early as possible.
+ // If you got an error_invalid_expression error message here,
+ // then the skipper is not a valid spirit qi expression.
+ BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Skipper);
+
+ typedef
+ typename result_of::compile<qi::domain, Skipper>::type
+ skipper_type;
+ skipper_type const skipper_ = compile<qi::domain>(skipper);
+
+ if (!compile<qi::domain>(expr).parse(
+ first, last, unused, skipper_, unused))
+ return false;
+
+ if (post_skip == skip_flag::postskip)
+ qi::skip_over(first, last, skipper_);
+ return true;
+ }
+ };
+
+}}}}
+
+#endif
+

Added: trunk/boost/spirit/home/qi/detail/parse_auto.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/qi/detail/parse_auto.hpp 2009-12-02 21:43:53 EST (Wed, 02 Dec 2009)
@@ -0,0 +1,59 @@
+/*=============================================================================
+ Copyright (c) 2001-2009 Hartmut Kaiser
+
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+=============================================================================*/
+#if !defined(BOOST_SPIRIT_DETAIL_PARSE_AUTO_DEC_02_2009_0426PM)
+#define BOOST_SPIRIT_DETAIL_PARSE_AUTO_DEC_02_2009_0426PM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/qi/detail/parse.hpp>
+#include <boost/spirit/home/qi/auto/create_parser.hpp>
+#include <boost/utility/enable_if.hpp>
+#include <boost/mpl/not.hpp>
+#include <boost/mpl/and.hpp>
+
+namespace boost { namespace spirit { namespace qi { namespace detail
+{
+ ///////////////////////////////////////////////////////////////////////////
+ template <typename Expr>
+ struct parse<Expr
+ , typename enable_if<traits::meta_create_exists<qi::domain, Expr> >::type>
+ {
+ template <typename Iterator>
+ static bool call(
+ Iterator& first
+ , Iterator last
+ , Expr const& expr)
+ {
+ return qi::parse(first, last, create_parser<Expr>()
+ , const_cast<Expr&>(expr));
+ }
+ };
+
+ ///////////////////////////////////////////////////////////////////////////
+ template <typename Expr>
+ struct phrase_parse<Expr
+ , typename enable_if<traits::meta_create_exists<qi::domain, Expr> >::type>
+ {
+ template <typename Iterator, typename Skipper>
+ static bool call(
+ Iterator& first
+ , Iterator last
+ , Expr const& expr
+ , Skipper const& skipper
+ , BOOST_SCOPED_ENUM(skip_flag) post_skip)
+ {
+ return qi::phrase_parse(first, last, create_parser<Expr>()
+ , skipper, post_skip, const_cast<Expr&>(expr));
+ }
+ };
+
+}}}}
+
+#endif
+

Added: trunk/boost/spirit/home/qi/match.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/qi/match.hpp 2009-12-02 21:43:53 EST (Wed, 02 Dec 2009)
@@ -0,0 +1,16 @@
+// Copyright (c) 2001-2009 Hartmut Kaiser
+//
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#if !defined(BOOST_SPIRIT_QI_MATCH_DEC_02_2009_0749PM)
+#define BOOST_SPIRIT_QI_MATCH_DEC_02_2009_0749PM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/qi/stream/match_manip.hpp>
+#include <boost/spirit/home/qi/stream/match_manip_attr.hpp>
+
+#endif

Added: trunk/boost/spirit/home/qi/match_auto.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/qi/match_auto.hpp 2009-12-02 21:43:53 EST (Wed, 02 Dec 2009)
@@ -0,0 +1,16 @@
+// Copyright (c) 2001-2009 Hartmut Kaiser
+//
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#if !defined(BOOST_SPIRIT_QI_MATCH_AUTO_DEC_02_2009_0750PM)
+#define BOOST_SPIRIT_QI_MATCH_AUTO_DEC_02_2009_0750PM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/qi/stream/match_manip.hpp>
+#include <boost/spirit/home/qi/stream/detail/match_manip_auto.hpp>
+
+#endif

Modified: trunk/boost/spirit/home/qi/parse.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/parse.hpp (original)
+++ trunk/boost/spirit/home/qi/parse.hpp 2009-12-02 21:43:53 EST (Wed, 02 Dec 2009)
@@ -1,5 +1,6 @@
 /*=============================================================================
     Copyright (c) 2001-2009 Joel de Guzman
+ Copyright (c) 2001-2009 Hartmut Kaiser
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -11,24 +12,11 @@
 #pragma once
 #endif
 
-#include <boost/spirit/home/qi/meta_compiler.hpp>
-#include <boost/spirit/home/qi/skip_over.hpp>
-#include <boost/spirit/home/support/unused.hpp>
-#include <boost/spirit/home/support/detail/scoped_enum_emulation.hpp>
-#include <boost/mpl/assert.hpp>
-#include <boost/mpl/bool.hpp>
+#include <boost/spirit/home/qi/detail/parse.hpp>
 
 namespace boost { namespace spirit { namespace qi
 {
     ///////////////////////////////////////////////////////////////////////////
- BOOST_SCOPED_ENUM_START(skip_flag)
- {
- postskip, // force post-skipping in phrase_parse()
- dont_postskip // inhibit post-skipping in phrase_parse()
- };
- BOOST_SCOPED_ENUM_END
-
- ///////////////////////////////////////////////////////////////////////////
     template <typename Iterator, typename Expr>
     inline bool
     parse(
@@ -36,11 +24,7 @@
       , Iterator last
       , Expr const& expr)
     {
- // Report invalid expression error as early as possible.
- // If you got an error_invalid_expression error message here,
- // then the expression (expr) is not a valid spirit qi expression.
- BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Expr);
- return compile<qi::domain>(expr).parse(first, last, unused, unused, unused);
+ return detail::parse<Expr>::call(first, last, expr);
     }
 
     template <typename Iterator, typename Expr, typename Attr>
@@ -48,7 +32,7 @@
     parse(
         Iterator& first
       , Iterator last
- , Expr const& expr
+ , Expr& expr
       , Attr& attr)
     {
         // Report invalid expression error as early as possible.
@@ -64,29 +48,12 @@
     phrase_parse(
         Iterator& first
       , Iterator last
- , Expr const& expr
+ , Expr& expr
       , Skipper const& skipper
       , BOOST_SCOPED_ENUM(skip_flag) post_skip = skip_flag::postskip)
     {
- // Report invalid expression error as early as possible.
- // If you got an error_invalid_expression error message here,
- // then either the expression (expr) or skipper is not a valid
- // spirit qi expression.
- BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Expr);
- BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Skipper);
-
- typedef
- typename result_of::compile<qi::domain, Skipper>::type
- skipper_type;
- skipper_type const skipper_ = compile<qi::domain>(skipper);
-
- if (!compile<qi::domain>(expr).parse(
- first, last, unused, skipper_, unused))
- return false;
-
- if (post_skip == skip_flag::postskip)
- qi::skip_over(first, last, skipper_);
- return true;
+ return detail::phrase_parse<Expr>::call(
+ first, last, expr, skipper, post_skip);
     }
 
     template <typename Iterator, typename Expr, typename Skipper, typename Attr>
@@ -125,7 +92,7 @@
     phrase_parse(
         Iterator& first
       , Iterator last
- , Expr const& expr
+ , Expr& expr
       , Skipper const& skipper
       , Attr& attr)
     {

Added: trunk/boost/spirit/home/qi/skip_flag.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/qi/skip_flag.hpp 2009-12-02 21:43:53 EST (Wed, 02 Dec 2009)
@@ -0,0 +1,29 @@
+/*=============================================================================
+ Copyright (c) 2001-2009 Hartmut Kaiser
+
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+=============================================================================*/
+#if !defined(BOOST_SPIRIT_SKIP_FLAG_DEC_02_2009_0412PM)
+#define BOOST_SPIRIT_SKIP_FLAG_DEC_02_2009_0412PM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/support/detail/scoped_enum_emulation.hpp>
+
+namespace boost { namespace spirit { namespace qi
+{
+ ///////////////////////////////////////////////////////////////////////////
+ BOOST_SCOPED_ENUM_START(skip_flag)
+ {
+ postskip, // force post-skipping in phrase_parse()
+ dont_postskip // inhibit post-skipping in phrase_parse()
+ };
+ BOOST_SCOPED_ENUM_END
+
+}}}
+
+#endif
+

Modified: trunk/boost/spirit/home/qi/stream/detail/match_manip.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/stream/detail/match_manip.hpp (original)
+++ trunk/boost/spirit/home/qi/stream/detail/match_manip.hpp 2009-12-02 21:43:53 EST (Wed, 02 Dec 2009)
@@ -22,7 +22,8 @@
 namespace boost { namespace spirit { namespace qi { namespace detail
 {
     ///////////////////////////////////////////////////////////////////////////
- template <typename Expr, typename Copy = mpl::false_
+ template <typename Expr
+ , typename CopyExpr = mpl::false_, typename CopyAttr = mpl::false_
       , typename Skipper = unused_type, typename Attribute = unused_type const>
     struct match_manip
     {
@@ -44,7 +45,7 @@
     };
 
     template <typename Expr, typename Skipper, typename Attribute>
- struct match_manip<Expr, mpl::true_, Skipper, Attribute>
+ struct match_manip<Expr, mpl::false_, mpl::true_, Skipper, Attribute>
     {
         match_manip(Expr const& xpr, Skipper const& s, Attribute& a)
           : expr(xpr), skipper(s), attr(a), post_skip(skip_flag::postskip) {}
@@ -63,11 +64,93 @@
         match_manip& operator= (match_manip const&);
     };
 
+ template <typename Expr, typename Skipper, typename Attribute>
+ struct match_manip<Expr, mpl::true_, mpl::false_, Skipper, Attribute>
+ {
+ match_manip(Expr const& xpr, Skipper const& s, Attribute& a)
+ : expr(xpr), skipper(s), attr(a), post_skip(skip_flag::postskip) {}
+
+ match_manip(Expr const& xpr, Skipper const& s
+ , BOOST_SCOPED_ENUM(skip_flag) ps, Attribute& a)
+ : expr(xpr), skipper(s), attr(a), post_skip(ps) {}
+
+ Expr expr;
+ Skipper const& skipper;
+ Attribute& attr;
+ BOOST_SCOPED_ENUM(skip_flag) const post_skip;
+
+ private:
+ // silence MSVC warning C4512: assignment operator could not be generated
+ match_manip& operator= (match_manip const&);
+ };
+
+ template <typename Expr, typename Skipper, typename Attribute>
+ struct match_manip<Expr, mpl::true_, mpl::true_, Skipper, Attribute>
+ {
+ BOOST_SPIRIT_ASSERT_MSG(false, error_invalid_should_not_happen, ());
+ };
+
+ ///////////////////////////////////////////////////////////////////////////
+ template <typename Expr, typename Enable = void>
+ struct match
+ {
+ // Report invalid expression error as early as possible.
+ // If you got an error_invalid_expression error message here,
+ // then the expression (expr) is not a valid spirit qi expression.
+ // Did you intend to use the auto_ facilities while forgetting to
+ // #include <boost/spirit/include/qi_match_auto.hpp>?
+ BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Expr);
+ };
+
+ template <typename Expr>
+ struct match<Expr
+ , typename enable_if<traits::matches<qi::domain, Expr> >::type>
+ {
+ typedef match_manip<Expr> type;
+
+ static type call(Expr const& expr)
+ {
+ return type(expr, unused, unused);
+ }
+ };
+
+ ///////////////////////////////////////////////////////////////////////////
+ template <typename Expr, typename Skipper, typename Enable = void>
+ struct phrase_match
+ {
+ // Report invalid expression error as early as possible.
+ // If you got an error_invalid_expression error message here,
+ // then the expression (expr) is not a valid spirit qi expression.
+ // Did you intend to use the auto_ facilities while forgetting to
+ // #include <boost/spirit/include/qi_match_auto.hpp>?
+ BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Expr);
+ };
+
+ template <typename Expr, typename Skipper>
+ struct phrase_match<Expr, Skipper
+ , typename enable_if<traits::matches<qi::domain, Expr> >::type>
+ {
+ typedef match_manip<Expr, mpl::false_, mpl::false_, Skipper> type;
+
+ static type call(
+ Expr const& expr
+ , Skipper const& skipper
+ , BOOST_SCOPED_ENUM(skip_flag) post_skip)
+ {
+ // Report invalid expression error as early as possible.
+ // If you got an error_invalid_expression error message here,
+ // then the delimiter is not a valid spirit karma expression.
+ BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Skipper);
+ return type(expr, skipper, post_skip, unused);
+ }
+ };
+
     ///////////////////////////////////////////////////////////////////////////
- template<typename Char, typename Traits, typename Expr, typename Copy>
+ template<typename Char, typename Traits, typename Expr
+ , typename CopyExpr, typename CopyAttr>
     inline std::basic_istream<Char, Traits> &
     operator>>(std::basic_istream<Char, Traits> &is,
- match_manip<Expr, Copy> const& fm)
+ match_manip<Expr, CopyExpr, CopyAttr> const& fm)
     {
         typedef std::istream_iterator<Char, Char, Traits> input_iterator;
         input_iterator f(is);
@@ -80,11 +163,12 @@
     }
 
     ///////////////////////////////////////////////////////////////////////////
- template<typename Char, typename Traits, typename Expr, typename Copy
+ template<typename Char, typename Traits, typename Expr
+ , typename CopyExpr, typename CopyAttr
       , typename Attribute>
     inline std::basic_istream<Char, Traits> &
     operator>>(std::basic_istream<Char, Traits> &is,
- match_manip<Expr, Copy, unused_type, Attribute> const& fm)
+ match_manip<Expr, CopyExpr, CopyAttr, unused_type, Attribute> const& fm)
     {
         typedef std::istream_iterator<Char, Char, Traits> input_iterator;
         input_iterator f(is);
@@ -97,11 +181,12 @@
     }
 
     ///////////////////////////////////////////////////////////////////////////
- template<typename Char, typename Traits, typename Expr, typename Copy
+ template<typename Char, typename Traits, typename Expr
+ , typename CopyExpr, typename CopyAttr
       , typename Skipper>
     inline std::basic_istream<Char, Traits> &
     operator>>(std::basic_istream<Char, Traits> &is,
- match_manip<Expr, Copy, Skipper> const& fm)
+ match_manip<Expr, CopyExpr, CopyAttr, Skipper> const& fm)
     {
         typedef std::istream_iterator<Char, Char, Traits> input_iterator;
         input_iterator f(is);
@@ -115,13 +200,14 @@
     }
 
     ///////////////////////////////////////////////////////////////////////////
- template<typename Char, typename Traits, typename Expr, typename Copy
+ template<typename Char, typename Traits, typename Expr
+ , typename CopyExpr, typename CopyAttr
       , typename Attribute, typename Skipper
>
     inline std::basic_istream<Char, Traits> &
     operator>>(
         std::basic_istream<Char, Traits> &is,
- match_manip<Expr, Copy, Attribute, Skipper> const& fm)
+ match_manip<Expr, CopyExpr, CopyAttr, Attribute, Skipper> const& fm)
     {
         typedef std::istream_iterator<Char, Char, Traits> input_iterator;
         input_iterator f(is);

Added: trunk/boost/spirit/home/qi/stream/detail/match_manip_auto.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/qi/stream/detail/match_manip_auto.hpp 2009-12-02 21:43:53 EST (Wed, 02 Dec 2009)
@@ -0,0 +1,63 @@
+/*=============================================================================
+ Copyright (c) 2001-2009 Hartmut Kaiser
+
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+#if !defined(BOOST_SPIRIT_MATCH_MANIP_AUTO_DEC_02_2009_0813PM)
+#define BOOST_SPIRIT_MATCH_MANIP_AUTO_DEC_02_2009_0813PM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/qi/stream/detail/match_manip.hpp>
+#include <boost/spirit/home/qi/auto/create_parser.hpp>
+#include <boost/utility/enable_if.hpp>
+
+///////////////////////////////////////////////////////////////////////////////
+namespace boost { namespace spirit { namespace qi { namespace detail
+{
+ ///////////////////////////////////////////////////////////////////////////
+ template <typename Expr>
+ struct match<Expr
+ , typename enable_if<traits::meta_create_exists<qi::domain, Expr> >::type>
+ {
+ typedef typename result_of::create_parser<Expr>::type expr_type;
+ typedef match_manip<
+ expr_type, mpl::true_, mpl::false_, unused_type, Expr
+ > type;
+
+ static type call(Expr const& expr)
+ {
+ return type(create_parser<Expr>(), unused, const_cast<Expr&>(expr));
+ }
+ };
+
+ ///////////////////////////////////////////////////////////////////////////
+ template <typename Expr, typename Skipper>
+ struct phrase_match<Expr, Skipper
+ , typename enable_if<traits::meta_create_exists<qi::domain, Expr> >::type>
+ {
+ typedef typename result_of::create_parser<Expr>::type expr_type;
+ typedef match_manip<
+ expr_type, mpl::true_, mpl::false_, Skipper, Expr
+ > type;
+
+ static type call(
+ Expr const& expr
+ , Skipper const& skipper
+ , BOOST_SCOPED_ENUM(skip_flag) post_skip)
+ {
+ // Report invalid expression error as early as possible.
+ // If you got an error_invalid_expression error message here,
+ // then the delimiter is not a valid spirit karma expression.
+ BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Skipper);
+ return type(create_parser<Expr>(), skipper, post_skip
+ , const_cast<Expr&>(expr));
+ }
+ };
+
+}}}}
+
+#endif

Modified: trunk/boost/spirit/home/qi/stream/match_manip.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/stream/match_manip.hpp (original)
+++ trunk/boost/spirit/home/qi/stream/match_manip.hpp 2009-12-02 21:43:53 EST (Wed, 02 Dec 2009)
@@ -22,19 +22,17 @@
 {
     ///////////////////////////////////////////////////////////////////////////
     template <typename Expr>
- inline detail::match_manip<Expr>
+ inline typename detail::match<Expr>::type
     match(
- Expr const& xpr)
+ Expr const& expr)
     {
- // Report invalid expression error as early as possible.
- // If you got an error_invalid_expression error message here,
- // then the expression (expr) is not a valid spirit qi expression.
- BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Expr);
- return qi::detail::match_manip<Expr>(xpr, unused, unused);
+ return detail::match<Expr>::call(expr);
     }
 
     template <typename Expr, typename Attribute>
- inline detail::match_manip<Expr, mpl::false_, unused_type, Attribute>
+ inline detail::match_manip<
+ Expr, mpl::false_, mpl::false_, unused_type, Attribute
+ >
     match(
         Expr const& xpr
       , Attribute& p)
@@ -45,32 +43,25 @@
         // If you got an error_invalid_expression error message here,
         // then the expression (expr) is not a valid spirit qi expression.
         BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Expr);
- return match_manip<Expr, mpl::false_, unused_type, Attribute>(
+ return match_manip<Expr, mpl::false_, mpl::false_, unused_type, Attribute>(
             xpr, unused, p);
     }
 
     ///////////////////////////////////////////////////////////////////////////
     template <typename Expr, typename Skipper>
- inline detail::match_manip<Expr, mpl::false_, Skipper>
+ inline typename detail::phrase_match<Expr, Skipper>::type
     phrase_match(
- Expr const& xpr
+ Expr const& expr
       , Skipper const& s
       , BOOST_SCOPED_ENUM(skip_flag) post_skip = skip_flag::postskip)
     {
- using qi::detail::match_manip;
-
- // Report invalid expression error as early as possible.
- // If you got an error_invalid_expression error message here,
- // then either the expression (expr) or skipper is not a valid
- // spirit qi expression.
- BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Expr);
- BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Skipper);
- return match_manip<Expr, mpl::false_, Skipper>(
- xpr, s, post_skip, unused);
+ return detail::phrase_match<Expr, Skipper>::call(expr, s, post_skip);
     }
 
     template <typename Expr, typename Skipper, typename Attribute>
- inline detail::match_manip<Expr, mpl::false_, Skipper, Attribute>
+ inline detail::match_manip<
+ Expr, mpl::false_, mpl::false_, Skipper, Attribute
+ >
     phrase_match(
         Expr const& xpr
       , Skipper const& s
@@ -85,12 +76,14 @@
         // spirit qi expression.
         BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Expr);
         BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Skipper);
- return match_manip<Expr, mpl::false_, Skipper, Attribute>(
+ return match_manip<Expr, mpl::false_, mpl::false_, Skipper, Attribute>(
             xpr, s, post_skip, p);
     }
 
     template <typename Expr, typename Skipper, typename Attribute>
- inline detail::match_manip<Expr, mpl::false_, Skipper, Attribute>
+ inline detail::match_manip<
+ Expr, mpl::false_, mpl::false_, Skipper, Attribute
+ >
     phrase_match(
         Expr const& xpr
       , Skipper const& s
@@ -104,7 +97,8 @@
         // spirit qi expression.
         BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Expr);
         BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Skipper);
- return match_manip<Expr, mpl::false_, Skipper, Attribute>(xpr, s, p);
+ return match_manip<Expr, mpl::false_, mpl::false_, Skipper, Attribute>(
+ xpr, s, p);
     }
 
     ///////////////////////////////////////////////////////////////////////////

Modified: trunk/boost/spirit/home/qi/stream/match_manip_attr.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/stream/match_manip_attr.hpp (original)
+++ trunk/boost/spirit/home/qi/stream/match_manip_attr.hpp 2009-12-02 21:43:53 EST (Wed, 02 Dec 2009)
@@ -40,7 +40,7 @@
 {
     ///////////////////////////////////////////////////////////////////////////
     template <typename Expr, BOOST_PP_ENUM_PARAMS(N, typename A)>
- inline detail::match_manip<Expr, mpl::true_, unused_type
+ inline detail::match_manip<Expr, mpl::false_, mpl::true_, unused_type
       , fusion::vector<
             BOOST_PP_ENUM(N, BOOST_SPIRIT_QI_ATTRIBUTE_REFERENCE, A)
> >
@@ -60,14 +60,14 @@
> vector_type;
 
         vector_type attr (BOOST_PP_ENUM_PARAMS(N, attr));
- return match_manip<Expr, mpl::true_, unused_type, vector_type>(
+ return match_manip<Expr, mpl::false_, mpl::true_, unused_type, vector_type>(
             xpr, unused, attr);
     }
 
     ///////////////////////////////////////////////////////////////////////////
     template <typename Expr, typename Skipper
       , BOOST_PP_ENUM_PARAMS(N, typename A)>
- inline detail::match_manip<Expr, mpl::true_, Skipper
+ inline detail::match_manip<Expr, mpl::false_, mpl::true_, Skipper
       , fusion::vector<
             BOOST_PP_ENUM(N, BOOST_SPIRIT_QI_ATTRIBUTE_REFERENCE, A)
> >
@@ -91,13 +91,13 @@
> vector_type;
 
         vector_type attr (BOOST_PP_ENUM_PARAMS(N, attr));
- return match_manip<Expr, mpl::true_, Skipper, vector_type>(
+ return match_manip<Expr, mpl::false_, mpl::true_, Skipper, vector_type>(
             xpr, s, post_skip, attr);
     }
 
     template <typename Expr, typename Skipper
       , BOOST_PP_ENUM_PARAMS(N, typename A)>
- inline detail::match_manip<Expr, mpl::true_, Skipper
+ inline detail::match_manip<Expr, mpl::false_, mpl::true_, Skipper
       , fusion::vector<
             BOOST_PP_ENUM(N, BOOST_SPIRIT_QI_ATTRIBUTE_REFERENCE, A)
> >
@@ -120,7 +120,8 @@
> vector_type;
 
         vector_type attr (BOOST_PP_ENUM_PARAMS(N, attr));
- return match_manip<Expr, mpl::true_, Skipper, vector_type>(xpr, s, attr);
+ return match_manip<Expr, mpl::false_, mpl::true_, Skipper, vector_type>(
+ xpr, s, attr);
     }
 
 }}}

Modified: trunk/boost/spirit/include/karma_format.hpp
==============================================================================
--- trunk/boost/spirit/include/karma_format.hpp (original)
+++ trunk/boost/spirit/include/karma_format.hpp 2009-12-02 21:43:53 EST (Wed, 02 Dec 2009)
@@ -13,6 +13,6 @@
 #pragma once
 #endif
 
-#include <boost/spirit/home/karma/stream/format_manip.hpp>
+#include <boost/spirit/home/karma/format.hpp>
 
 #endif

Added: trunk/boost/spirit/include/karma_format_auto.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/include/karma_format_auto.hpp 2009-12-02 21:43:53 EST (Wed, 02 Dec 2009)
@@ -0,0 +1,18 @@
+/*=============================================================================
+ Copyright (c) 2001-2009 Joel de Guzman
+ Copyright (c) 2001-2009 Hartmut Kaiser
+ http://spirit.sourceforge.net/
+
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+=============================================================================*/
+#ifndef BOOST_SPIRIT_INCLUDE_KARMA_FORMAT_AUTO
+#define BOOST_SPIRIT_INCLUDE_KARMA_FORMAT_AUTO
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/karma/format_auto.hpp>
+
+#endif

Added: trunk/boost/spirit/include/karma_generate_auto.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/include/karma_generate_auto.hpp 2009-12-02 21:43:53 EST (Wed, 02 Dec 2009)
@@ -0,0 +1,19 @@
+/*=============================================================================
+ Copyright (c) 2001-2009 Joel de Guzman
+ Copyright (c) 2001-2009 Hartmut Kaiser
+ http://spirit.sourceforge.net/
+
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+=============================================================================*/
+#ifndef BOOST_SPIRIT_INCLUDE_KARMA_GENERATE_AUTO
+#define BOOST_SPIRIT_INCLUDE_KARMA_GENERATE_AUTO
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/karma/generate.hpp>
+#include <boost/spirit/home/karma/detail/generate_auto.hpp>
+
+#endif

Modified: trunk/boost/spirit/include/qi_match.hpp
==============================================================================
--- trunk/boost/spirit/include/qi_match.hpp (original)
+++ trunk/boost/spirit/include/qi_match.hpp 2009-12-02 21:43:53 EST (Wed, 02 Dec 2009)
@@ -13,6 +13,6 @@
 #pragma once
 #endif
 
-#include <boost/spirit/home/qi/stream/match_manip.hpp>
+#include <boost/spirit/home/qi/match.hpp>
 
 #endif

Added: trunk/boost/spirit/include/qi_match_auto.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/include/qi_match_auto.hpp 2009-12-02 21:43:53 EST (Wed, 02 Dec 2009)
@@ -0,0 +1,18 @@
+/*=============================================================================
+ Copyright (c) 2001-2009 Joel de Guzman
+ Copyright (c) 2001-2009 Hartmut Kaiser
+ http://spirit.sourceforge.net/
+
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+=============================================================================*/
+#ifndef BOOST_SPIRIT_INCLUDE_QI_MATCH_AUTO
+#define BOOST_SPIRIT_INCLUDE_QI_MATCH_AUTO
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/qi/match_auto.hpp>
+
+#endif

Added: trunk/boost/spirit/include/qi_parse_auto.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/include/qi_parse_auto.hpp 2009-12-02 21:43:53 EST (Wed, 02 Dec 2009)
@@ -0,0 +1,19 @@
+/*=============================================================================
+ Copyright (c) 2001-2009 Joel de Guzman
+ Copyright (c) 2001-2009 Hartmut Kaiser
+ http://spirit.sourceforge.net/
+
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+=============================================================================*/
+#ifndef BOOST_SPIRIT_INCLUDE_QI_PARSE_AUTO
+#define BOOST_SPIRIT_INCLUDE_QI_PARSE_AUTO
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/qi/parse.hpp>
+#include <boost/spirit/home/qi/detail/parse_auto.hpp>
+
+#endif


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