imenu parsing of ObjC classes and selectors

JD Smith <[email protected]>
Newsgroups gmane.emacs.cc-mode.general
Message-ID <[email protected]>
I've been working on a bunch of ObjC lately, and for the most part objc-mode (CC-mode v5.35.2) works well for it.  Sometimes, however, I notice imenu fails to parse certain class implementations correctly.  Not sure why.  Here's an example excerpt.   

Here's imenu's listing for this file (from imenu--make-index-alist):

(("NSMutableArray(Emacs)" . 1882) ("-enqueue:" . 1922)
 ("-dequeue" . 2030) ("NSData" . 19) ("NSString" . 200)
 ("NSFont" . 1588) ("NSFont" . 1844))

It has a number of problems:

    • It produces spurious matches for the @end // Class (Category) lines
    • It fails to group methods with class (aka selector in ObjC).  This does work for many cases, not sure why it sometimes fails.
    • It misses entirely the methods under NSData and NSString.
    • When "class method" association does work, sometimes it associates with the prior class in the file (not features in this reproducer).

 Happy to try any tests.  Thanks for the CC-mode family: true workhorses!

JDS
objc_imenu.m (application/octet-stream, 2.2 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.