
Mihalicza, Jozsef wrote:
I've built a spirit grammer to process the token sequence of wave.
1. Scope missing in macros. The first problem arose when I tried to write the wave token equivalent of chlit: struct token_lit : public boost::spirit::char_parser
{ token_lit(boost::wave::token_id id_) : id(id_) {} template <typename T> bool test(T id_) const { return BASE_TOKEN(id_) == BASE_TOKEN(id); } boost::wave::token_id id; }; The code above doesn't compile, because BASE_TOKEN uses constants from boost::wave without explicit scope. Lines to fix: token_ids.hpp(37-40,305,309).
That's fixed now (Boost CVS HEAD and BOOST_RC_1_33_0 branches). The wave code itself always uses "using namespace boost::wave;" directives. For this reason this bug never got recognised.
2. Newline token reports bad position. For debug purposes I reported the match positions in the grammer actions using the file_position interface of the wave token type. The results were quite strange, sometimes pointing into the middle of a keyword, so I decided to take a smaller step and modified the wave example (the one in the documentation) just to see what happens, as follows: while (first != last) { std::cout << "value: \"" << (*first).get_value() << "\" pos: " << (*first).get_position ().get_file () << "(" << (*first).get_position ().get_line () << ") @" << (*first).get_position ().get_column () << std::endl; ++first; } Attached you can find some very small inputs and their corresponding outputs. 2.1. A file containing only whites and comments produced no tokens at all 2.2. Position of the enter token reports the new line number but the old column 2.3. The #line directive affects the position in a very strange way
Please clarify if some of these are not errors.
Oops, I almost forgot, I am using a fresh verison from the CVS repository already containing the fix for the SF bug #1274584.
Working on that, stay tuned... Thanks for reporting these problems! Regards Hartmut