Date: 2007-05-22 15:29:02
On 20070519, Felipe Magno de Almeida wrote:
> I wanted to propose found_include_directive returning a bool. Where
> false would skip including the file.
> I need this so that I can selectively skip including files. I'm
> writing a dependency analysis for C++ files.
This analysis may fail unless all the files are processed... An #include
file may #define something that changes how the rest of the source is
processed (e.g. "#define USE_FALLBACK_LIB").
Instead, you probably want a filter which eliminates tokens based on their
#include depth (obtained from context::get_iteration_depth()). This is
convenient since the context is already passed to found_include_directive.
To filter tokens before they are parsed, construct the context object,
loop over context::begin() to end(), populate a new list with tokens of
depth=0, and hand this second list to the parser.
Who learned this issue/solution from another user.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk