The hooks you are proposing satisfies my needs very well and appreciate that
you add these hooks to Wave as it makes and will make my life a lot easier.
I agree to your point on the comments and can build the rest I need on top
of Wave. When and how should I expect to be able to test a new Wave version
with these hooks?
Thanks,
Andreas
On 11/1/05, Hartmut Kaiser
extracting the C/C++ statement or expression
that the unexpanded macro (and expanded) is a part of. I was thinking about to add new hooks to the preprocessing hooks template from the very beginning. Sorry for not beeing consise enough.
For consistency reasons I'ld suggest to add a hook:
template <typename TokenT> void found_directive(TokenT const& directive);
Where directive refers to the token containing the found pp directive.
yes, so that I can extract the unexpanded preprocessor conditional expression and when this expression is (macro-)expanded if the result is positive or negative. For instance in the example #define BAR #ifdef BAR int x; #ifdef FOO int y; #endif #endif I would be interested in extracting '#ifdef BAR' and also that it is evaluated as true. I would also be interested in extracting '#ifdef FOO' and that it is evaluated as false.
What about:
template <typename ContainerT> void evaluated_conditional_expression(ContainerT const& expression, bool expression_value);
Where: - expression contains the (not expanded) expression tokensequence and - expression_value is the result of the evaluation of this expression.
*after evaluating the preprocessor conditional, extract the portion which was evaluated as false as a string
#define positive #ifdef int positive #endif /*Extract this false part as string*/ int x; #endif
template <typename ContainerT> void skipped_token(TokenT const& token);
Where token is the skipped token. This hook will be called for each token which gets skipped due to a false preproccessing condition.
I am only interested in defined macros. To be more specific I am interested in when the preprocessor recognises a macro. For each macro it is interesting to extract the value and position in the file. The macro can be found in two forms; the one before macro-expansion and the one after. Both forms are interesting. But this is from what I have seen already handled in struct default_preprocessing_hooks. 1: #define FOO int x; 2: FOO On line 2 in this example code the macro FOO is found. This macro can be expanded to 'int x', which to the preprocessor is equivalent to the unexpanded macro FOO found on line 1.
Yeah, I was already wondering how you might want to decide whether a identifier actually is a 'undefined' macro :-P This information already should be avalable through the existing preproceesing hooks.
*extracting the C/C++ statement or expression that the unexpanded macro (and expanded) is a part of.
This conceptually isn't possible at the preprocessor level because it has no notion of a C++ statement/expression.
I would not like to put any functionality into the library which does not belong to its purpose: preprocessing C++. I'm pretty sure, that you'll be able to build this on top of Wave.
*extract the value and position of all C and C++ comments
This one is easy. Just enable the preserve comments mode and all the comment tokens will be part of the generated output token sequence.
Great. :) What about making a hook for this within stuct default_preprocessing_hooks also?
Why? The preprocessing hooks are there to allow to access information not available from the generated token stream itself, i.e. information about the actual work inside the preprocessor. But the comments are available in the generated token stream already. If I would add such a hook, somebody else would like to have a special hook for line endings etc.
It would be very interesting to do some work on this, and it would be useful to hear what you think about adding the additional hooks we have been talking about. Maybe these hooks should be better specified.
Do these new hooks satisfy your needs?
Regards Hartmut
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users