Wave problem - missing token_type definition?

Hi, In the Quickstart page of the Wave docs there is an example: typedef wave::context<std::string::iterator, wave::cpplexer::lex_token<> > context_t; Above, the context type gets the lex_token<> as a second parameter. The problem is that inside the context type (cpp_context.hpp:75 in boost-1.33.1) there is: typedef typename LexIteratorT::token_type token_type; LexIteratorT is a second template parameter, which is lex_token in the above example - and there is no token_type type defined in lex_token. This results in the following compile-time error (g++ 3.2.3): /local/include/boost_1_33_1/boost/wave/cpp_context.hpp:75: no type named ` token_type' in `class boost::wave::cpplexer::lex_token<boost::wave::util::file_position<boost::wave::util::flex_string<char, std::char_traits<char>, std::allocator<char>, boost::wave::util::CowString<boost::wave::util::AllocatorStringStorage<char, std::allocator<char> >, char*> > > >' Am I missing something obvious? The smallest code example with this problem is: #include <boost/wave.hpp> #include <boost/wave/cpplexer/cpp_lex_token.hpp> #include <iostream> #include <fstream> #include <string> #include <iterator> int main() { std::ifstream file("wavetest.cpp"); std::string input( std::istreambuf_iterator<char>(file.rdbuf()), std::istreambuf_iterator<char>()); typedef boost::wave::context<std::string::iterator, boost::wave::cpplexer::lex_token<> > context_t; context_t ctx(input.begin(), input.end(), "wavetest.cpp"); } Regards, -- Maciej Sobczak : http://www.msobczak.com/ Programming : http://www.msobczak.com/prog/

Maciej Sobczak wrote:
In the Quickstart page of the Wave docs there is an example:
typedef wave::context<std::string::iterator, wave::cpplexer::lex_token<> > context_t;
OK, after a bit of experimenting, I can answer myself - it should be: typedef wave::context<std::string::iterator, wave::cpplexer::lex_iterator< wave::cpplexer::lex_token<> > > context_t; The initial (wrong) version was taken from the wave-1.0.0 distribution. It's correct in the version that comes with boost-1.33.1. Regards, -- Maciej Sobczak : http://www.msobczak.com/ Programming : http://www.msobczak.com/prog/

Maciej Sobczak wrote:
In the Quickstart page of the Wave docs there is an example:
typedef wave::context<std::string::iterator, wave::cpplexer::lex_token<> > context_t;
This was a bug in the documentation, which has been fixed already (see here: http://tinyurl.com/rcgkj / http://boost-consulting.com/boost/libs/wave/doc/quickstart.html). It should be: // The template boost::wave::cpplexer::lex_token<> is the // token type to be used by the Wave library. typedef boost::wave::cpplexer::lex_token<> token_type; // The template boost::wave::cpplexer::lex_iterator<> is // the lexer type to be used by the Wave library. typedef boost::wave::cpplexer::lex_iterator< token_type> lex_iterator_type; // This is the resulting context type to use. The first // template parameter should match the iterator type to // be used during construction of the corresponding context // object (see below). typedef boost::wave::context< std::string::iterator, lex_iterator_type> context_type; Which compiles fine. Thanks for reporting! Regards Hartmut
participants (2)
-
Hartmut Kaiser
-
Maciej Sobczak