[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: two imenu entries for same function in C-mode
From: |
martin rudalics |
Subject: |
Re: two imenu entries for same function in C-mode |
Date: |
Wed, 20 Apr 2005 09:36:22 +0200 |
User-agent: |
Mozilla Thunderbird 1.0 (Windows/20041206) |
(On a related note, any regex junkies want to take a crack at the c-mode
regex(es)? Some of those "identifiers" found in abbrev.c are buried in
comments.)
-Dave
... you can find them in strings too. However, regexps are not well
suited to establish whether an identifier is within a string or comment.
One could apply heuristics to rule out more blatant occurrences but this
might be expensive. I see three ways to handle this problem:
(1) Impose strict rules on comment and string styles. For example, you
could require that any left paren within a comment or string must be
preceded by a backslash. However, such rules aren't even followed
very closely by elisp programmers. Also, routines for commenting
out/in code would have to be rewritten accordingly.
(2) Rewrite Imenu in order to do some minimal parsing. This would
require to duplicate the first two passes of font-lock and write
something similar to font-lock's third pass. Suitable for people
who don't like syntax highlighting.
(3) Let font-lock do the work. In this case, the _entire_ buffer would
have to be fontified immediately when visiting a file. Stealth
fontification could be only applied after buffer modifications and
would have to be synchronized appropriately with Imenu lookup.