|
Boost Users : |
From: Hartmut Kaiser (hartmut.kaiser_at_[hidden])
Date: 2007-06-07 19:12:18
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
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