I want to programmatically analyze and edit C ++ source files. I need to change / add code to certain sections of code (i.e. In functions, class blocks, etc.). I also (preferably) could also get comments.
Part of what I want to do can be explained by the following code snippet:
CPlusPlusSourceParser cp = new CPlusPlusSourceParser("x.cpp");
CPlusPlusSourceFunction[] funcs = cp.getFunctions();
for (int i = 0; i < funcs.length; i++) {
funcs[i].append();
}
cp.save();
cp.close();
How can i do this?
I'd like to do this preferably in Java, C ++, Perl, Python or C #. However, I am open to other languages API.
source
share