How can the parser determine which comment belong to the correct token?
This is absolutely not easy. Often you find such code snippets:
/* My comment on the function */
/* const */ RetObj& MyFunc (int i, float b) // b=0
{
// ...
}
How would you differ which comment to show?
The only thing I can imagine is to support e.g. doxygen comments only. In that case the code would look like:
/** My doxygen comment on the function */
/* const */ RetObj& MyFunc (int i, float b) // b=0
{
// ...
}
...and you could easily search for comments between "
/**" and "
*/" before a function. Hence using specialisations like:
int myInt; //!< My Doxygen comment
...which are possible in principle for functions, too would be difficult.
So - the only idea I have is to support doxygen style comments before a function. The last question: What to show? The documentation of the declaration, or implementation, both can be applicable and appear twice.
Edit: I'll also tell you what I usually do:
I create code with full doxygen documentation. Then I create the documentation and embed this into C::B as a help file. Thus I have always every documentation available. Because mostly I not only need the docs of the function, but some others, too. which are nicely liinked in the generated help.