I am facing a following problem: I need to generate detailed reports for Objective-C source code (written for iOS). I need to be able to display following:
Class report:
Class name | File location | Number of methods
ClassA | /my/path/ClassA.m | 7
ClassB | /my/path/ClassB.m | 12
….
Methods report:
Method name | Class name | File location
method1 | ClassA | /my/path/ClassA.m
method2 | ClassA | /my/path/ClassA.m
….
And I also need to be able display few other reports but at this moment I am interested just to start from somewhere.
Please note:
– At the moment I do not have requirement to have number of lines/complexity/etc displayed.
– Report similar to above one is sufficient (as long as it contains information above I will be really happy; I can parse the info and create the report that is needed)
– I have already looked at Doxygen and its xml output but for few sample projects that I run I did not get all methods listed in xml documentation (even though they are in the files). I have to investigate why these methods are not showing up.
Thanks in advance to all the answers/hints/comments….
Depending on your proficiency with Java, you might want to take a look at JavaCC. It also has a grammar for parsing Objective-C 2.0.
http://lists.apple.com/archives/java-dev/2010/Sep/msg00097.html
I confess I barely opened the grammar to look at how complex/simple it is. It looked well organized but I didn’t experiment with it myself. Generally speaking, JavaCC looks a bit steep at first glance but with a couple of hours of toying around with it, you should find your marks pretty quickly. Once you get it though, parsing any language becomes really easy.