I want to implement a simple utility that would take a C source file and a name of a function, struct, enum or whatever and output the comment directly above the element if present.
Ie.
/* This is a doc comment
* I want this comment extracted
*/
void function_foo(){
}
Usage:
utility file.c function_foo
Output:
This is a doc comment
I want this comment extracted
The use case for this is that I want to use org-babel in emacs to tangle in documentation for functions right out of source files. Maybe there is a doxygen tool or clang tool that can do this? I just haven't found it yet. The end result would be that I can easily keep up to date documentation extracted from code directly inside my documentation org file that contains other things as well.
c++
-style// comments
? Can there be/*more*/ than one /*comment*/
in a line? And is there a chance that literalc
strings contain/*
(char* foo = "Break your /* regexp";
)?go doc
will extract it for you with no extra work. :)