Ludovic Aubert wrote:
So I am getting a sequence of tokens (line, column, value). As the iteration over tokens progresses, so do the column and line values, as expected from left to right and top to bottom. But if a macro like STD_BEGIN is encontered, the replacement (ie "namespace std {") will bear the column and line values from the location where it is defined. My goal is to insert '\n' characters in order to reconstruct the original line numbering in the output buffer. The macro in this exemple makes it very difficult or is there any way to do this in a simple way ?
There is an example in Wave (at least in Boost CVS::HEAD) called 'real_positions' doing just what you want. It uses the generated_token() preprocessing hook to keep track of the actual token position and stores this position inside the token (this example uses a special token type carrying both, the original and the actual position. Please note that this pp hook has been added recently only and it is not yet available in Boost 1.34. HTH Regards Hartmut