Boost logo

Boost Users :

From: Olaf Peter (ope-devel_at_[hidden])
Date: 2008-04-17 15:09:53


at this time, I try to separate the instances of spirit grammars into
several files; this mean rewrite the functor parsers to grammars and
move the implementation of grammar ctor into an own file. Anyway, this
does not compile:

--- header---
     struct left_bracket_termated_string_parser
         : spirit::grammar<...>
     {
         template <typename ScannerT>
         struct definition
         {
             typedef sp::rule<ScannerT> rule_t;

             rule_t str;

             rule_t const& start() const { return str; }

             definition( const left_bracket_termated_string_parser& self );
         };

     };

     const left_bracket_termated_string_parser sbt_str_p;

----
--- source ---
template<> 
left_bracket_termated_string_parser::definition<sp::scanner>::definition( 
const left_bracket_termated_string_parser& self )
     {
         using namespace ::boost::spirit;
         using namespace ::phoenix;
         str
             = (
                 *( anychar_p -  ch_p( '[' ) )
                 )[ self.result_ = construct_<std::string>( arg1, arg2 ) ]
             ;
     }
----
The error is:
error: type/value mismatch at argument 1 in template parameter list for 
'template<class ScannerT> struct 
left_bracket_termated_string_parser::definition'
error:   expected a type, got 'scanner'
error: 'definition' is not a template function
Anyway, does this help t reduce compile time.
Thanks,
Olaf

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net