Boost logo

Boost-Commit :

From: hartmut.kaiser_at_[hidden]
Date: 2008-04-18 20:06:03


Author: hkaiser
Date: 2008-04-18 20:06:02 EDT (Fri, 18 Apr 2008)
New Revision: 44562
URL: http://svn.boost.org/trac/boost/changeset/44562

Log:
Spirit: Removed testing for compatibility of skipper and delimiter with the rule. Added some comments at the place where the compilation error occurs if skipper of delimiter are incompatible.
Text files modified:
   trunk/boost/spirit/home/karma/generate.hpp | 31 -------------------------------
   trunk/boost/spirit/home/karma/nonterminal/grammar.hpp | 20 --------------------
   trunk/boost/spirit/home/karma/nonterminal/rule.hpp | 30 +++++-------------------------
   trunk/boost/spirit/home/qi/nonterminal/grammar.hpp | 18 ------------------
   trunk/boost/spirit/home/qi/nonterminal/rule.hpp | 27 +++++----------------------
   trunk/boost/spirit/home/qi/parse.hpp | 30 ------------------------------
   6 files changed, 10 insertions(+), 146 deletions(-)

Modified: trunk/boost/spirit/home/karma/generate.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/generate.hpp (original)
+++ trunk/boost/spirit/home/karma/generate.hpp 2008-04-18 20:06:02 EDT (Fri, 18 Apr 2008)
@@ -17,21 +17,6 @@
 #include <boost/mpl/assert.hpp>
 #include <boost/mpl/bool.hpp>
 
-///////////////////////////////////////////////////////////////////////////
-namespace boost { namespace spirit { namespace traits
-{
- // normally any skipper can be used with any generator
- template <typename Generator, typename Delimiter>
- struct delimiter_is_compatible : mpl::true_
- {
- };
-
- // If the parser is a rule or a grammar, then the delimiter must be
- // convertible to the delimiter used with this rule or grammar. The
- // corresponding specializations are defined in the files grammar.hpp and
- // rule.hpp.
-}}}
-
 ///////////////////////////////////////////////////////////////////////////////
 namespace boost { namespace spirit { namespace karma
 {
@@ -104,14 +89,6 @@
         BOOST_MPL_ASSERT_MSG(delimiter_is_component::value,
             delimiter_is_not_convertible_to_a_generator,
             (OutputIterator, Expr, Delimiter));
-
- typedef spirit::traits::delimiter_is_compatible<Expr, Delimiter>
- delimiter_is_compatible;
-
- BOOST_MPL_ASSERT_MSG(
- delimiter_is_compatible::value,
- delimiter_is_not_compatible_with_generator,
- (OutputIterator, Expr, Delimiter));
         
         // wrap user supplied iterator into our own output iterator
         detail::output_iterator<OutputIterator> sink(target_sink);
@@ -151,14 +128,6 @@
         BOOST_MPL_ASSERT_MSG(delimiter_is_component::value,
             delimiter_is_not_convertible_to_a_generator,
             (OutputIterator, Expr, Parameter, Delimiter));
-
- typedef spirit::traits::delimiter_is_compatible<Expr, Delimiter>
- delimiter_is_compatible;
-
- BOOST_MPL_ASSERT_MSG(
- delimiter_is_compatible::value,
- delimiter_is_not_compatible_with_generator,
- (OutputIterator, Expr, Parameter, Delimiter));
         
         // wrap user supplied iterator into our own output iterator
         detail::output_iterator<OutputIterator> sink(target_sink);

Modified: trunk/boost/spirit/home/karma/nonterminal/grammar.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/nonterminal/grammar.hpp (original)
+++ trunk/boost/spirit/home/karma/nonterminal/grammar.hpp 2008-04-18 20:06:02 EDT (Fri, 18 Apr 2008)
@@ -113,24 +113,4 @@
     
 }}}
 
-///////////////////////////////////////////////////////////////////////////////
-namespace boost { namespace spirit { namespace traits
-{
- // forward declaration only (the default specialization is defined in the
- // file generate.hpp)
- template <typename Generator, typename Delimiter>
- struct delimiter_is_compatible;
-
- // If the parser is a grammar, then the delimiter must be convertible to
- // the delimiter used with this grammar.
- template <typename Definition, typename Delimiter>
- struct delimiter_is_compatible<karma::grammar<Definition>, Delimiter>
- : is_convertible<
- Delimiter, typename karma::grammar<Definition>::delimiter_type
- >
- {
- };
-
-}}}
-
 #endif

Modified: trunk/boost/spirit/home/karma/nonterminal/rule.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/nonterminal/rule.hpp (original)
+++ trunk/boost/spirit/home/karma/nonterminal/rule.hpp 2008-04-18 20:06:02 EDT (Fri, 18 Apr 2008)
@@ -159,6 +159,11 @@
         bool generate(
             OutputIterator_& sink, Context& context, Delimiter const& delim) const
         {
+ // If the following line produces a compilation error stating the
+ // 3rd parameter is not convertible to the expected type, then you
+ // probably trying to use this rule instance with a delimiter which
+ // is not compatible with the delimiter type used while defining
+ // the type of this rule instance.
             return ptr->generate(sink, context, delim);
         }
 
@@ -188,31 +193,6 @@
 
 }}}
 
-///////////////////////////////////////////////////////////////////////////////
-namespace boost { namespace spirit { namespace traits
-{
- // forward declaration only (the default specialization is defined in the
- // file generate.hpp)
- template <typename Generator, typename Delimiter>
- struct delimiter_is_compatible;
-
- // If the parser is a rule, then the delimiter must be convertible to
- // the delimiter used with this rule.
- template <
- typename OutputIterator, typename T0, typename T1, typename T2,
- typename Delimiter
- >
- struct delimiter_is_compatible<
- karma::rule<OutputIterator, T0, T1, T2>, Delimiter>
- : is_convertible<
- Delimiter,
- typename karma::rule<OutputIterator, T0, T1, T2>::delimiter_type
- >
- {
- };
-
-}}}
-
 #if defined(BOOST_MSVC)
 # pragma warning(pop)
 #endif

Modified: trunk/boost/spirit/home/qi/nonterminal/grammar.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/nonterminal/grammar.hpp (original)
+++ trunk/boost/spirit/home/qi/nonterminal/grammar.hpp 2008-04-18 20:06:02 EDT (Fri, 18 Apr 2008)
@@ -123,22 +123,4 @@
     
 }}}
 
-///////////////////////////////////////////////////////////////////////////////
-namespace boost { namespace spirit { namespace traits
-{
- // forward declaration only (the default specialization is defined in the
- // file parse.hpp)
- template <typename Parser, typename Skipper>
- struct skipper_is_compatible;
-
- // If the parser is a grammar, then the skipper must be convertible to
- // the skipper used with this grammar.
- template <typename Definition, typename Skipper>
- struct skipper_is_compatible<qi::grammar<Definition>, Skipper>
- : is_convertible<Skipper, typename qi::grammar<Definition>::skipper_type>
- {
- };
-
-}}}
-
 #endif

Modified: trunk/boost/spirit/home/qi/nonterminal/rule.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/nonterminal/rule.hpp (original)
+++ trunk/boost/spirit/home/qi/nonterminal/rule.hpp 2008-04-18 20:06:02 EDT (Fri, 18 Apr 2008)
@@ -168,6 +168,11 @@
             Iterator_& first, Iterator_ const& last
           , Context& context, Skipper const& skipper) const
         {
+ // If the following line produces a compilation error stating the
+ // 4th parameter is not convertible to the expected type, then you
+ // probably trying to use this rule instance with a skipper which
+ // is not compatible with the skipper type used while defining the
+ // type of this rule instance.
             return ptr->parse(first, last, context, skipper);
         }
 
@@ -356,28 +361,6 @@
 
 }}}
 
-///////////////////////////////////////////////////////////////////////////////
-namespace boost { namespace spirit { namespace traits
-{
- // forward declaration only
- template <typename Parser, typename Skipper>
- struct skipper_is_compatible;
-
- // If the parser is a rule, then the skipper must be convertible to
- // the skipper used with this rule.
- template <
- typename Iterator, typename T0, typename T1, typename T2,
- typename Skipper
- >
- struct skipper_is_compatible<qi::rule<Iterator, T0, T1, T2>, Skipper>
- : is_convertible<
- Skipper, typename qi::rule<Iterator, T0, T1, T2>::skipper_type
- >
- {
- };
-
-}}}
-
 #if defined(BOOST_MSVC)
 # pragma warning(pop)
 #endif

Modified: trunk/boost/spirit/home/qi/parse.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/parse.hpp (original)
+++ trunk/boost/spirit/home/qi/parse.hpp 2008-04-18 20:06:02 EDT (Fri, 18 Apr 2008)
@@ -13,21 +13,6 @@
 #include <boost/mpl/assert.hpp>
 #include <boost/mpl/bool.hpp>
 
-///////////////////////////////////////////////////////////////////////////
-namespace boost { namespace spirit { namespace traits
-{
- // normally any skipper can be used with any parser
- template <typename Parser, typename Skipper>
- struct skipper_is_compatible : mpl::true_
- {
- };
-
- // If the parser is a rule or a grammar, then the skipper must be
- // convertible to the skipper used with this rule or grammar. The
- // corresponding specializations are defined in the files grammar.hpp and
- // rule.hpp.
-}}}
-
 namespace boost { namespace spirit { namespace qi
 {
     template <typename Iterator, typename Expr>
@@ -92,13 +77,6 @@
             skipper_is_component::value,
             skipper_is_not_convertible_to_a_parser, (Iterator, Expr, Skipper));
 
- typedef spirit::traits::skipper_is_compatible<Expr, Skipper>
- skipper_is_compatible;
-
-// BOOST_MPL_ASSERT_MSG(
-// skipper_is_compatible::value,
-// skipper_is_not_compatible_with_parser, (Iterator, Expr, Skipper));
-
         typedef typename result_of::as_component<qi::domain, Expr>::type component;
         typedef typename component::director director;
         component c = spirit::as_component(qi::domain(), xpr);
@@ -137,14 +115,6 @@
             skipper_is_not_convertible_to_a_parser,
             (Iterator, Expr, Attr, Skipper));
 
- typedef spirit::traits::skipper_is_compatible<Expr, Skipper>
- skipper_is_compatible;
-
- BOOST_MPL_ASSERT_MSG(
- skipper_is_compatible::value,
- skipper_is_not_compatible_with_parser,
- (Iterator, Expr, Attr, Skipper));
-
         typedef typename result_of::as_component<qi::domain, Expr>::type component;
         typedef typename component::director director;
         component c = spirit::as_component(qi::domain(), xpr);


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