Changeset 44562


Ignore:
Timestamp:
Apr 19, 2008, 12:06:02 AM (10 years ago)
Author:
Hartmut Kaiser
Message:

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.

Location:
trunk/boost/spirit/home
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/boost/spirit/home/karma/generate.hpp

    r44358 r44562  
    1717#include <boost/mpl/assert.hpp>
    1818#include <boost/mpl/bool.hpp>
    19 
    20 ///////////////////////////////////////////////////////////////////////////
    21 namespace boost { namespace spirit { namespace traits
    22 {
    23     // normally any skipper can be used with any generator
    24     template <typename Generator, typename Delimiter>
    25     struct delimiter_is_compatible : mpl::true_
    26     {
    27     };
    28    
    29     // If the parser is a rule or a grammar, then the delimiter must be
    30     // convertible to the delimiter used with this rule or grammar. The
    31     // corresponding specializations are defined in the files grammar.hpp and
    32     // rule.hpp.
    33 }}}
    3419
    3520///////////////////////////////////////////////////////////////////////////////
     
    10590            delimiter_is_not_convertible_to_a_generator,
    10691            (OutputIterator, Expr, Delimiter));
    107 
    108         typedef spirit::traits::delimiter_is_compatible<Expr, Delimiter>
    109             delimiter_is_compatible;
    110            
    111         BOOST_MPL_ASSERT_MSG(
    112             delimiter_is_compatible::value,
    113             delimiter_is_not_compatible_with_generator,
    114             (OutputIterator, Expr, Delimiter));
    11592       
    11693        // wrap user supplied iterator into our own output iterator
     
    152129            delimiter_is_not_convertible_to_a_generator,
    153130            (OutputIterator, Expr, Parameter, Delimiter));
    154 
    155         typedef spirit::traits::delimiter_is_compatible<Expr, Delimiter>
    156             delimiter_is_compatible;
    157            
    158         BOOST_MPL_ASSERT_MSG(
    159             delimiter_is_compatible::value,
    160             delimiter_is_not_compatible_with_generator,
    161             (OutputIterator, Expr, Parameter, Delimiter));
    162131       
    163132        // wrap user supplied iterator into our own output iterator
  • trunk/boost/spirit/home/karma/nonterminal/grammar.hpp

    r44358 r44562  
    114114}}}
    115115
    116 ///////////////////////////////////////////////////////////////////////////////
    117 namespace boost { namespace spirit { namespace traits
    118 {
    119     // forward declaration only (the default specialization is defined in the
    120     // file generate.hpp)
    121     template <typename Generator, typename Delimiter>
    122     struct delimiter_is_compatible;
    123    
    124     // If the parser is a grammar, then the delimiter must be convertible to
    125     // the delimiter used with this grammar.
    126     template <typename Definition, typename Delimiter>
    127     struct delimiter_is_compatible<karma::grammar<Definition>, Delimiter>
    128       : is_convertible<
    129             Delimiter, typename karma::grammar<Definition>::delimiter_type
    130         >
    131     {
    132     };
    133 
    134 }}}
    135 
    136116#endif
  • trunk/boost/spirit/home/karma/nonterminal/rule.hpp

    r44358 r44562  
    160160            OutputIterator_& sink, Context& context, Delimiter const& delim) const
    161161        {
     162            // If the following line produces a compilation error stating the
     163            // 3rd parameter is not convertible to the expected type, then you
     164            // probably trying to use this rule instance with a delimiter which
     165            // is not compatible with the delimiter type used while defining
     166            // the type of this rule instance.
    162167            return ptr->generate(sink, context, delim);
    163168        }
     
    189194}}}
    190195
    191 ///////////////////////////////////////////////////////////////////////////////
    192 namespace boost { namespace spirit { namespace traits
    193 {
    194     // forward declaration only (the default specialization is defined in the
    195     // file generate.hpp)
    196     template <typename Generator, typename Delimiter>
    197     struct delimiter_is_compatible;
    198    
    199     // If the parser is a rule, then the delimiter must be convertible to
    200     // the delimiter used with this rule.
    201     template <
    202         typename OutputIterator, typename T0, typename T1, typename T2,
    203         typename Delimiter
    204     >
    205     struct delimiter_is_compatible<
    206             karma::rule<OutputIterator, T0, T1, T2>, Delimiter>
    207       : is_convertible<
    208             Delimiter,
    209             typename karma::rule<OutputIterator, T0, T1, T2>::delimiter_type
    210         >
    211     {
    212     };
    213 
    214 }}}
    215 
    216196#if defined(BOOST_MSVC)
    217197# pragma warning(pop)
  • trunk/boost/spirit/home/qi/nonterminal/grammar.hpp

    r44358 r44562  
    124124}}}
    125125
    126 ///////////////////////////////////////////////////////////////////////////////
    127 namespace boost { namespace spirit { namespace traits
    128 {
    129     // forward declaration only (the default specialization is defined in the
    130     // file parse.hpp)
    131     template <typename Parser, typename Skipper>
    132     struct skipper_is_compatible;
    133    
    134     // If the parser is a grammar, then the skipper must be convertible to
    135     // the skipper used with this grammar.
    136     template <typename Definition, typename Skipper>
    137     struct skipper_is_compatible<qi::grammar<Definition>, Skipper>
    138       : is_convertible<Skipper, typename qi::grammar<Definition>::skipper_type>
    139     {
    140     };
    141 
    142 }}}
    143 
    144126#endif
  • trunk/boost/spirit/home/qi/nonterminal/rule.hpp

    r44561 r44562  
    169169          , Context& context, Skipper const& skipper) const
    170170        {
     171            // If the following line produces a compilation error stating the
     172            // 4th parameter is not convertible to the expected type, then you
     173            // probably trying to use this rule instance with a skipper which
     174            // is not compatible with the skipper type used while defining the
     175            // type of this rule instance.
    171176            return ptr->parse(first, last, context, skipper);
    172177        }
     
    357362}}}
    358363
    359 ///////////////////////////////////////////////////////////////////////////////
    360 namespace boost { namespace spirit { namespace traits
    361 {
    362     // forward declaration only
    363     template <typename Parser, typename Skipper>
    364     struct skipper_is_compatible;
    365 
    366     // If the parser is a rule, then the skipper must be convertible to
    367     // the skipper used with this rule.
    368     template <
    369         typename Iterator, typename T0, typename T1, typename T2,
    370         typename Skipper
    371     >
    372     struct skipper_is_compatible<qi::rule<Iterator, T0, T1, T2>, Skipper>
    373       : is_convertible<
    374             Skipper, typename qi::rule<Iterator, T0, T1, T2>::skipper_type
    375         >
    376     {
    377     };
    378 
    379 }}}
    380 
    381364#if defined(BOOST_MSVC)
    382365# pragma warning(pop)
  • trunk/boost/spirit/home/qi/parse.hpp

    r44527 r44562  
    1313#include <boost/mpl/assert.hpp>
    1414#include <boost/mpl/bool.hpp>
    15 
    16 ///////////////////////////////////////////////////////////////////////////
    17 namespace boost { namespace spirit { namespace traits
    18 {
    19     // normally any skipper can be used with any parser
    20     template <typename Parser, typename Skipper>
    21     struct skipper_is_compatible : mpl::true_
    22     {
    23     };
    24    
    25     // If the parser is a rule or a grammar, then the skipper must be
    26     // convertible to the skipper used with this rule or grammar. The
    27     // corresponding specializations are defined in the files grammar.hpp and
    28     // rule.hpp.
    29 }}}
    3015
    3116namespace boost { namespace spirit { namespace qi
     
    9378            skipper_is_not_convertible_to_a_parser, (Iterator, Expr, Skipper));
    9479
    95         typedef spirit::traits::skipper_is_compatible<Expr, Skipper>
    96             skipper_is_compatible;
    97            
    98 //         BOOST_MPL_ASSERT_MSG(
    99 //             skipper_is_compatible::value,
    100 //             skipper_is_not_compatible_with_parser, (Iterator, Expr, Skipper));
    101        
    10280        typedef typename result_of::as_component<qi::domain, Expr>::type component;
    10381        typedef typename component::director director;
     
    138116            (Iterator, Expr, Attr, Skipper));
    139117
    140         typedef spirit::traits::skipper_is_compatible<Expr, Skipper>
    141             skipper_is_compatible;
    142            
    143         BOOST_MPL_ASSERT_MSG(
    144             skipper_is_compatible::value,
    145             skipper_is_not_compatible_with_parser,
    146             (Iterator, Expr, Attr, Skipper));
    147        
    148118        typedef typename result_of::as_component<qi::domain, Expr>::type component;
    149119        typedef typename component::director director;
Note: See TracChangeset for help on using the changeset viewer.