Thanks, that was what I needed to get going.

Cheers
/David

On Sun, May 10, 2009 at 5:37 PM, Hartmut Kaiser <hartmut.kaiser@gmail.com> wrote:
> I'm trying to use booost.wave to parse some C headers and generate code
> for
> each function declaration found.
>
> How would you write code that identifies all function declarations?
>
> Is there any higher level structure that helps me finding this or do I
> need to
> create some state machine that matches the pattern for a function
> declaration
> from what's found in the token iterator?

Wave is a tokenizing preprocessor. That means all it can do is to return the
recognized C++ tokens as seen in the input stream. In order to make some
sense out of the token stream you need to write a parser matching the input
you're looking for. You might want to look at one of Wave's examples,
Hannibal, which is a partial C++ parser written using Spirit V1.8. In your
case a much simpler grammar should be sufficient, though, as you're looking
for function declarations only. Another pointer could be:
http://gsd.web.elte.hu/contents/articles/gpce06.pdf. Those guys were using
Spirit/Wave to instrument C++ code for template metaprogramming debugging
purposes.

HTH
Regards Hartmut




_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users