|
Boost Users : |
From: Andreas Sæbjørnsen (andreas.saebjoernsen_at_[hidden])
Date: 2006-11-07 22:46:40
Hi Hartmut,
> IIUC you want to discard the information about the macro definition and make
> the token stream look like it was the original input stream. This is not
> possible with Wave as it is.
>
It seems that we agree, but let me clarify my previous problem
description so that we know that I put this in a clear way. I am using
preprocessor hooks to fetch the macro before and after expansion. My
problem is that the macro after expansion has the positions of the
macro definition while I want it to have the positions of the current
line. The reason why I want this is that I want to compare the
position of tokens in Wave with the positions of constructs in an
Abstract Syntax Tree, so e.g identifier 'x' in token stream is found
to have the same positions as an identifier 'x' of a variable
declaration in the AST.
> My first thought was to use boost::transform_iterator on top of the wave
> iterators and to maintain a separate file position based on the tokens
> passed through it. But this doesn't work, because this iterator kicks in
> every time the transform_iterator is dereferenced, so you end up correcting
> the current file position each time. Clearly indirection doesn't work easily
> here...
>
> So I'm not sure yet, how to achieve this, but at least I have some ideas, at
> which points this could be injected into Wave. Please give me some more time
> to contemplate...
Thank you very much for looking into this! It is very much appreciated.
>
> Do you have any thought's on that?
I am not so versed in the implementation details that I feel confident
suggesting too much, but I will contemplate on this too. A separate
position would be great, but in the absence of that maybe the
positions could be changed through a normalization stage after macro
expansion although I am worried about that not working too well with
the preprocessor hooks.
Thanks
Andreas
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