annotate lisp/progmodes/cc-menus.el @ 33188:387b12461c12

(auto-image-file-mode): Drop unneeded positional args.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Fri, 03 Nov 2000 22:17:58 +0000
parents 8f3b77df5346
children dd613770eb0f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1 ;;; cc-menus.el --- imenu support for CC Mode
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2
30405
f1a6dfd30c21 Update copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents: 26817
diff changeset
3 ;; Copyright (C) 1985,1987,1992-2000 Free Software Foundation, Inc.
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4
30405
f1a6dfd30c21 Update copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents: 26817
diff changeset
5 ;; Authors: 2000- Martin Stjernholm
f1a6dfd30c21 Update copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents: 26817
diff changeset
6 ;; 1998-1999 Barry A. Warsaw and Martin Stjernholm
24282
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 23855
diff changeset
7 ;; 1992-1997 Barry A. Warsaw
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8 ;; 1987 Dave Detlefs and Stewart Clamen
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9 ;; 1985 Richard M. Stallman
24282
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 23855
diff changeset
10 ;; Maintainer: bug-cc-mode@gnu.org
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11 ;; Created: 22-Apr-1997 (split from cc-mode.el)
20145
cfd9922ca72b Patches to Imenu support given by
Karl Heuer <kwzh@gnu.org>
parents: 20134
diff changeset
12 ;; Version: See cc-mode.el
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13 ;; Keywords: c languages oop
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15 ;; This file is part of GNU Emacs.
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
17 ;; GNU Emacs is free software; you can redistribute it and/or modify
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
18 ;; it under the terms of the GNU General Public License as published by
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
19 ;; the Free Software Foundation; either version 2, or (at your option)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
20 ;; any later version.
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
21
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
22 ;; GNU Emacs is distributed in the hope that it will be useful,
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
23 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
24 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
25 ;; GNU General Public License for more details.
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
26
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
27 ;; You should have received a copy of the GNU General Public License
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
28 ;; along with GNU Emacs; see the file COPYING. If not, write to the
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
29 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
30 ;; Boston, MA 02111-1307, USA.
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
31
24282
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 23855
diff changeset
32 (eval-when-compile
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24783
diff changeset
33 (let ((load-path
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24783
diff changeset
34 (if (and (boundp 'byte-compile-current-file)
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24783
diff changeset
35 (stringp byte-compile-current-file))
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24783
diff changeset
36 (cons (file-name-directory byte-compile-current-file)
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24783
diff changeset
37 load-path)
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24783
diff changeset
38 load-path)))
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24783
diff changeset
39 (load "cc-defs" nil t)))
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24783
diff changeset
40
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24783
diff changeset
41 ;; Dummy definitions to shut up the compiler in case imenu doesn't exist.
33080
8f3b77df5346 (imenu-generic-expression)
Dave Love <fx@gnu.org>
parents: 30405
diff changeset
42 (eval-when-compile
8f3b77df5346 (imenu-generic-expression)
Dave Love <fx@gnu.org>
parents: 30405
diff changeset
43 (defvar imenu-generic-expression)
8f3b77df5346 (imenu-generic-expression)
Dave Love <fx@gnu.org>
parents: 30405
diff changeset
44 (defvar imenu-case-fold-search))
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24783
diff changeset
45 (or (fboundp 'imenu-progress-message)
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24783
diff changeset
46 (defun imenu-progress-message (&rest args) nil))
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24783
diff changeset
47
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24783
diff changeset
48 ;; Try to pull in imenu.
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24783
diff changeset
49 (eval-and-compile
24282
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 23855
diff changeset
50 (condition-case nil
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 23855
diff changeset
51 (require 'imenu)
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 23855
diff changeset
52 (error nil)))
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 23855
diff changeset
53
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
54
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
55 ;; imenu integration
20134
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
56 (defvar cc-imenu-c-prototype-macro-regexp nil
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
57 "RE matching macro names used to conditionally specify function prototypes.
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
58
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
59 For example:
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
60
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
61 #ifdef __STDC__
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
62 #define _P(x) x
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
63 #else
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
64 #define _P(x) /*nothing*/
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
65 #endif
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
66
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
67 int main _P( (int argc, char *argv[]) )
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
68
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
69 A sample value might look like: `\\(_P\\|_PROTO\\)'.")
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
70
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
71 (defvar cc-imenu-c++-generic-expression
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24783
diff changeset
72 `(
20134
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
73 ;; Try to match ::operator definitions first. Otherwise `X::operator new ()'
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
74 ;; will be incorrectly recognised as function `new ()' because the regexps
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
75 ;; work by backtracking from the end of the definition.
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
76 (nil
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24783
diff changeset
77 ,(concat
20134
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
78 "^\\<.*"
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
79 "[^a-zA-Z0-9_:<>~]" ; match any non-identifier char
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
80 ; (note: this can be `\n')
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
81 "\\("
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
82 "\\([a-zA-Z0-9_:<>~]*::\\)?" ; match an operator
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
83 "operator\\>[ \t]*"
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
84 "\\(()\\|[^(]*\\)" ; special case for `()' operator
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
85 "\\)"
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
86
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
87 "[ \t]*([^)]*)[ \t]*[^ \t;]" ; followed by ws, arg list,
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
88 ; require something other than
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
89 ; a `;' after the (...) to
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
90 ; avoid prototypes. Can't
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
91 ; catch cases with () inside
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
92 ; the parentheses surrounding
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
93 ; the parameters. e.g.:
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
94 ; `int foo(int a=bar()) {...}'
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24783
diff changeset
95 ) 1)
20134
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
96 ;; Special case to match a line like `main() {}'
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
97 ;; e.g. no return type, not even on the previous line.
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
98 (nil
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24783
diff changeset
99 ,(concat
20134
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
100 "^"
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
101 "\\([a-zA-Z_][a-zA-Z0-9_:<>~]*\\)" ; match function name
20916
704b7ccba694 Imenu support changed.
Richard M. Stallman <rms@gnu.org>
parents: 20507
diff changeset
102 "[ \t]*(" ; see above, BUT
704b7ccba694 Imenu support changed.
Richard M. Stallman <rms@gnu.org>
parents: 20507
diff changeset
103 "[ \t]*\\([^ \t(*][^)]*\\)?)" ; the arg list must not start
704b7ccba694 Imenu support changed.
Richard M. Stallman <rms@gnu.org>
parents: 20507
diff changeset
104 "[ \t]*[^ \t;(]" ; with an asterisk or parentheses
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24783
diff changeset
105 ) 1)
20145
cfd9922ca72b Patches to Imenu support given by
Karl Heuer <kwzh@gnu.org>
parents: 20134
diff changeset
106 ;; General function name regexp
cfd9922ca72b Patches to Imenu support given by
Karl Heuer <kwzh@gnu.org>
parents: 20134
diff changeset
107 (nil
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24783
diff changeset
108 ,(concat
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24783
diff changeset
109 "^\\<" ; line MUST start with word char
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24783
diff changeset
110 "[^()]*" ; no parentheses before
20145
cfd9922ca72b Patches to Imenu support given by
Karl Heuer <kwzh@gnu.org>
parents: 20134
diff changeset
111 "[^a-zA-Z0-9_:<>~]" ; match any non-identifier char
cfd9922ca72b Patches to Imenu support given by
Karl Heuer <kwzh@gnu.org>
parents: 20134
diff changeset
112 "\\([a-zA-Z_][a-zA-Z0-9_:<>~]*\\)" ; match function name
cfd9922ca72b Patches to Imenu support given by
Karl Heuer <kwzh@gnu.org>
parents: 20134
diff changeset
113 "[ \t]*(" ; see above, BUT
20916
704b7ccba694 Imenu support changed.
Richard M. Stallman <rms@gnu.org>
parents: 20507
diff changeset
114 "[ \t]*\\([^ \t(*][^)]*\\)?)" ; the arg list must not start
704b7ccba694 Imenu support changed.
Richard M. Stallman <rms@gnu.org>
parents: 20507
diff changeset
115 "[ \t]*[^ \t;(]" ; with an asterisk or parentheses
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24783
diff changeset
116 ) 1)
20134
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
117 ;; Special case for definitions using phony prototype macros like:
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
118 ;; `int main _PROTO( (int argc,char *argv[]) )'.
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
119 ;; This case is only included if cc-imenu-c-prototype-macro-regexp is set.
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
120 ;; Only supported in c-code, so no `:<>~' chars in function name!
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24783
diff changeset
121 ,@(if cc-imenu-c-prototype-macro-regexp
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24783
diff changeset
122 `((nil
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24783
diff changeset
123 ,(concat
20134
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
124 "^\\<.*" ; line MUST start with word char
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
125 "[^a-zA-Z0-9_]" ; match any non-identifier char
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
126 "\\([a-zA-Z_][a-zA-Z0-9_]*\\)" ; match function name
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
127 "[ \t]*" ; whitespace before macro name
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
128 cc-imenu-c-prototype-macro-regexp
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
129 "[ \t]*(" ; ws followed by first paren.
20145
cfd9922ca72b Patches to Imenu support given by
Karl Heuer <kwzh@gnu.org>
parents: 20134
diff changeset
130 "[ \t]*([^)]*)[ \t]*)[ \t]*[^ \t;]" ; see above
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24783
diff changeset
131 ) 1)))
20134
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
132 ;; Class definitions
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
133 ("Class"
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24783
diff changeset
134 ,(concat
20134
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
135 "^" ; beginning of line is required
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
136 "\\(template[ \t]*<[^>]+>[ \t]*\\)?" ; there may be a `template <...>'
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
137 "class[ \t]+"
24282
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 23855
diff changeset
138 "\\(" ; the string we want to get
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 23855
diff changeset
139 "[a-zA-Z0-9_]+" ; class name
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 23855
diff changeset
140 "\\(<[^>]+>\\)?" ; possibly explicitely specialized
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 23855
diff changeset
141 "\\)"
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24783
diff changeset
142 "[ \t\n]*[:{]"
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24783
diff changeset
143 ) 2))
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
144 "Imenu generic expression for C++ mode. See `imenu-generic-expression'.")
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
145
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
146 (defvar cc-imenu-c-generic-expression
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
147 cc-imenu-c++-generic-expression
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
148 "Imenu generic expression for C mode. See `imenu-generic-expression'.")
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
149
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
150 (defvar cc-imenu-java-generic-expression
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24783
diff changeset
151 `((nil
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24783
diff changeset
152 ,(concat
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
153 "^\\([ \t]\\)*"
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24783
diff changeset
154 "\\([.A-Za-z0-9_-]+[ \t]+\\)?" ; type specs; there can be
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24783
diff changeset
155 "\\([.A-Za-z0-9_-]+[ \t]+\\)?" ; more than 3 tokens, right?
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24783
diff changeset
156 "\\([.A-Za-z0-9_-]+[ \t]*[[]?[]]?\\)"
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
157 "\\([ \t]\\)"
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
158 "\\([A-Za-z0-9_-]+\\)" ; the string we want to get
24282
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 23855
diff changeset
159 "\\([ \t]*\\)+("
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24783
diff changeset
160 "[][a-zA-Z,_1-9\n \t]*" ; arguments
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
161 ")[ \t]*"
20134
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
162 ; "[^;(]"
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
163 "[,a-zA-Z_1-9\n \t]*{"
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24783
diff changeset
164 ) 6))
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
165 "Imenu generic expression for Java mode. See `imenu-generic-expression'.")
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
166
20916
704b7ccba694 Imenu support changed.
Richard M. Stallman <rms@gnu.org>
parents: 20507
diff changeset
167 ;; *Warning for cc-mode developers*
704b7ccba694 Imenu support changed.
Richard M. Stallman <rms@gnu.org>
parents: 20507
diff changeset
168 ;;
704b7ccba694 Imenu support changed.
Richard M. Stallman <rms@gnu.org>
parents: 20507
diff changeset
169 ;; `cc-imenu-objc-generic-expression' elements depend on
704b7ccba694 Imenu support changed.
Richard M. Stallman <rms@gnu.org>
parents: 20507
diff changeset
170 ;; `cc-imenu-c++-generic-expression'. So if you change this
704b7ccba694 Imenu support changed.
Richard M. Stallman <rms@gnu.org>
parents: 20507
diff changeset
171 ;; expression, you need to change following variables,
704b7ccba694 Imenu support changed.
Richard M. Stallman <rms@gnu.org>
parents: 20507
diff changeset
172 ;; `cc-imenu-objc-generic-expression-*-index',
704b7ccba694 Imenu support changed.
Richard M. Stallman <rms@gnu.org>
parents: 20507
diff changeset
173 ;; too. `cc-imenu-objc-function' uses these *-index variables, in
704b7ccba694 Imenu support changed.
Richard M. Stallman <rms@gnu.org>
parents: 20507
diff changeset
174 ;; order to know where the each regexp *group \\(foobar\\)* elements
704b7ccba694 Imenu support changed.
Richard M. Stallman <rms@gnu.org>
parents: 20507
diff changeset
175 ;; are started.
704b7ccba694 Imenu support changed.
Richard M. Stallman <rms@gnu.org>
parents: 20507
diff changeset
176 ;;
704b7ccba694 Imenu support changed.
Richard M. Stallman <rms@gnu.org>
parents: 20507
diff changeset
177 ;; *-index variables are initialized during `cc-imenu-objc-generic-expression'
704b7ccba694 Imenu support changed.
Richard M. Stallman <rms@gnu.org>
parents: 20507
diff changeset
178 ;; being initialized.
704b7ccba694 Imenu support changed.
Richard M. Stallman <rms@gnu.org>
parents: 20507
diff changeset
179 ;;
704b7ccba694 Imenu support changed.
Richard M. Stallman <rms@gnu.org>
parents: 20507
diff changeset
180
704b7ccba694 Imenu support changed.
Richard M. Stallman <rms@gnu.org>
parents: 20507
diff changeset
181 ;; Internal variables
704b7ccba694 Imenu support changed.
Richard M. Stallman <rms@gnu.org>
parents: 20507
diff changeset
182 (defvar cc-imenu-objc-generic-expression-noreturn-index nil)
704b7ccba694 Imenu support changed.
Richard M. Stallman <rms@gnu.org>
parents: 20507
diff changeset
183 (defvar cc-imenu-objc-generic-expression-general-func-index nil)
704b7ccba694 Imenu support changed.
Richard M. Stallman <rms@gnu.org>
parents: 20507
diff changeset
184 (defvar cc-imenu-objc-generic-expression-proto-index nil)
704b7ccba694 Imenu support changed.
Richard M. Stallman <rms@gnu.org>
parents: 20507
diff changeset
185 (defvar cc-imenu-objc-generic-expression-objc-base-index nil)
704b7ccba694 Imenu support changed.
Richard M. Stallman <rms@gnu.org>
parents: 20507
diff changeset
186
20134
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
187 (defvar cc-imenu-objc-generic-expression
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
188 (concat
20145
cfd9922ca72b Patches to Imenu support given by
Karl Heuer <kwzh@gnu.org>
parents: 20134
diff changeset
189 ;;
20134
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
190 ;; For C
20145
cfd9922ca72b Patches to Imenu support given by
Karl Heuer <kwzh@gnu.org>
parents: 20134
diff changeset
191 ;;
cfd9922ca72b Patches to Imenu support given by
Karl Heuer <kwzh@gnu.org>
parents: 20134
diff changeset
192 ;; > Special case to match a line like `main() {}'
cfd9922ca72b Patches to Imenu support given by
Karl Heuer <kwzh@gnu.org>
parents: 20134
diff changeset
193 ;; > e.g. no return type, not even on the previous line.
cfd9922ca72b Patches to Imenu support given by
Karl Heuer <kwzh@gnu.org>
parents: 20134
diff changeset
194 ;; Pick a token by (match-string 1)
20916
704b7ccba694 Imenu support changed.
Richard M. Stallman <rms@gnu.org>
parents: 20507
diff changeset
195 (car (cdr (nth 1 cc-imenu-c++-generic-expression))) ; -> index += 2
704b7ccba694 Imenu support changed.
Richard M. Stallman <rms@gnu.org>
parents: 20507
diff changeset
196 (prog2 (setq cc-imenu-objc-generic-expression-noreturn-index 1) "")
20145
cfd9922ca72b Patches to Imenu support given by
Karl Heuer <kwzh@gnu.org>
parents: 20134
diff changeset
197 "\\|"
cfd9922ca72b Patches to Imenu support given by
Karl Heuer <kwzh@gnu.org>
parents: 20134
diff changeset
198 ;; > General function name regexp
20916
704b7ccba694 Imenu support changed.
Richard M. Stallman <rms@gnu.org>
parents: 20507
diff changeset
199 ;; Pick a token by (match-string 3)
704b7ccba694 Imenu support changed.
Richard M. Stallman <rms@gnu.org>
parents: 20507
diff changeset
200 (car (cdr (nth 2 cc-imenu-c++-generic-expression))) ; -> index += 2
704b7ccba694 Imenu support changed.
Richard M. Stallman <rms@gnu.org>
parents: 20507
diff changeset
201 (prog2 (setq cc-imenu-objc-generic-expression-general-func-index 3) "")
20145
cfd9922ca72b Patches to Imenu support given by
Karl Heuer <kwzh@gnu.org>
parents: 20134
diff changeset
202 ;; > Special case for definitions using phony prototype macros like:
cfd9922ca72b Patches to Imenu support given by
Karl Heuer <kwzh@gnu.org>
parents: 20134
diff changeset
203 ;; > `int main _PROTO( (int argc,char *argv[]) )'.
20916
704b7ccba694 Imenu support changed.
Richard M. Stallman <rms@gnu.org>
parents: 20507
diff changeset
204 ;; Pick a token by (match-string 5)
20145
cfd9922ca72b Patches to Imenu support given by
Karl Heuer <kwzh@gnu.org>
parents: 20134
diff changeset
205 (if cc-imenu-c-prototype-macro-regexp
cfd9922ca72b Patches to Imenu support given by
Karl Heuer <kwzh@gnu.org>
parents: 20134
diff changeset
206 (concat
cfd9922ca72b Patches to Imenu support given by
Karl Heuer <kwzh@gnu.org>
parents: 20134
diff changeset
207 "\\|"
20916
704b7ccba694 Imenu support changed.
Richard M. Stallman <rms@gnu.org>
parents: 20507
diff changeset
208 (car (cdr (nth 3 cc-imenu-c++-generic-expression))) ; -> index += 1
704b7ccba694 Imenu support changed.
Richard M. Stallman <rms@gnu.org>
parents: 20507
diff changeset
209 (prog2 (setq cc-imenu-objc-generic-expression-objc-base-index 6) "")
704b7ccba694 Imenu support changed.
Richard M. Stallman <rms@gnu.org>
parents: 20507
diff changeset
210 )
704b7ccba694 Imenu support changed.
Richard M. Stallman <rms@gnu.org>
parents: 20507
diff changeset
211 (prog2 (setq cc-imenu-objc-generic-expression-objc-base-index 5) "")
704b7ccba694 Imenu support changed.
Richard M. Stallman <rms@gnu.org>
parents: 20507
diff changeset
212 "") ; -> index += 0
704b7ccba694 Imenu support changed.
Richard M. Stallman <rms@gnu.org>
parents: 20507
diff changeset
213 (prog2 (setq cc-imenu-objc-generic-expression-proto-index 5) "")
20145
cfd9922ca72b Patches to Imenu support given by
Karl Heuer <kwzh@gnu.org>
parents: 20134
diff changeset
214 ;;
20134
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
215 ;; For Objective-C
20916
704b7ccba694 Imenu support changed.
Richard M. Stallman <rms@gnu.org>
parents: 20507
diff changeset
216 ;; Pick a token by (match-string 5 or 6)
20145
cfd9922ca72b Patches to Imenu support given by
Karl Heuer <kwzh@gnu.org>
parents: 20134
diff changeset
217 ;;
20134
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
218 "\\|\\("
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
219 "^[-+][:a-zA-Z0-9()*_<>\n\t ]*[;{]" ; Methods
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
220 "\\|"
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
221 "^@interface[\t ]+[a-zA-Z0-9_]+[\t ]*:"
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
222 "\\|"
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
223 "^@interface[\t ]+[a-zA-Z0-9_]+[\t ]*([a-zA-Z0-9_]+)"
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
224 "\\|"
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
225 ;; For NSObject, NSProxy and Object... They don't have super class.
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
226 "^@interface[\t ]+[a-zA-Z0-9_]+[\t ]*.*$"
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
227 "\\|"
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
228 "^@implementation[\t ]+[a-zA-Z0-9_]+[\t ]*([a-zA-Z0-9_]+)"
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
229 "\\|"
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
230 "^@implementation[\t ]+[a-zA-Z0-9_]+"
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
231 "\\|"
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
232 "^@protocol[\t ]+[a-zA-Z0-9_]+" "\\)")
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
233 "Imenu generic expression for ObjC mode. See `imenu-generic-expression'.")
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
234
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
235
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
236 ;; Imenu support for objective-c uses functions.
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
237 (defsubst cc-imenu-objc-method-to-selector (method)
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
238 "Return the objc selector style string of METHOD.
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
239 Example:
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
240 - perform: (SEL)aSelector withObject: object1 withObject: object2; /* METHOD */
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
241 =>
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
242 -perform:withObject:withObject:withObject: /* selector */"
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
243 (let ((return "") ; String to be returned
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
244 (p 0) ; Current scanning position in METHOD
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
245 (pmax (length method)) ;
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
246 char ; Current scanning target
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
247 (betweenparen 0) ; CHAR is in parentheses.
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
248 argreq ; An argument is required.
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
249 inargvar) ; position of CHAR is in an argument variable.
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
250 (while (< p pmax)
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
251 (setq char (aref method p)
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
252 p (1+ p))
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
253 (cond
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
254 ;; Is CHAR part of a objc token?
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
255 ((and (not inargvar) ; Ignore if CHAR is part of an argument variable.
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
256 (eq 0 betweenparen) ; Ignore if CHAR is in parentheses.
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
257 (or (and (<= ?a char) (<= char ?z))
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
258 (and (<= ?A char) (<= char ?Z))
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
259 (and (<= ?0 char) (<= char ?9))
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
260 (= ?_ char)))
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
261 (if argreq
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
262 (setq inargvar t
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
263 argreq nil)
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
264 (setq return (concat return (char-to-string char)))))
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
265 ;; Or a white space?
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
266 ((and inargvar (or (eq ?\ char) (eq ?\n char))
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
267 (setq inargvar nil)))
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
268 ;; Or a method separator?
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
269 ;; If a method separator, the next token will be an argument variable.
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
270 ((eq ?: char)
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
271 (setq argreq t
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
272 return (concat return (char-to-string char))))
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
273 ;; Or an open parentheses?
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
274 ((eq ?\( char)
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
275 (setq betweenparen (1+ betweenparen)))
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
276 ;; Or a close parentheses?
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
277 ((eq ?\) char)
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
278 (setq betweenparen (1- betweenparen)))))
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
279 return))
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
280
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
281 (defun cc-imenu-objc-remove-white-space (str)
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
282 "Remove all spaces and tabs from STR."
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
283 (let ((return "")
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
284 (p 0)
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
285 (max (length str))
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
286 char)
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
287 (while (< p max)
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
288 (setq char (aref str p))
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
289 (setq p (1+ p))
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
290 (if (or (= char ?\ ) (= char ?\t))
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
291 ()
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
292 (setq return (concat return (char-to-string char)))))
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
293 return))
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
294
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
295 (defun cc-imenu-objc-function ()
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
296 "imenu supports for objc-mode."
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
297 (let (methodlist
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
298 clist
20145
cfd9922ca72b Patches to Imenu support given by
Karl Heuer <kwzh@gnu.org>
parents: 20134
diff changeset
299 ;;
20916
704b7ccba694 Imenu support changed.
Richard M. Stallman <rms@gnu.org>
parents: 20507
diff changeset
300 ;; OBJC, Cnoreturn, Cgeneralfunc, Cproto are constants.
20145
cfd9922ca72b Patches to Imenu support given by
Karl Heuer <kwzh@gnu.org>
parents: 20134
diff changeset
301 ;;
cfd9922ca72b Patches to Imenu support given by
Karl Heuer <kwzh@gnu.org>
parents: 20134
diff changeset
302 ;; *Warning for developers*
cfd9922ca72b Patches to Imenu support given by
Karl Heuer <kwzh@gnu.org>
parents: 20134
diff changeset
303 ;; These constants depend on `cc-imenu-c++-generic-expression'.
cfd9922ca72b Patches to Imenu support given by
Karl Heuer <kwzh@gnu.org>
parents: 20134
diff changeset
304 ;;
20916
704b7ccba694 Imenu support changed.
Richard M. Stallman <rms@gnu.org>
parents: 20507
diff changeset
305 (OBJC cc-imenu-objc-generic-expression-objc-base-index)
704b7ccba694 Imenu support changed.
Richard M. Stallman <rms@gnu.org>
parents: 20507
diff changeset
306 ;; Special case to match a line like `main() {}'
704b7ccba694 Imenu support changed.
Richard M. Stallman <rms@gnu.org>
parents: 20507
diff changeset
307 (Cnoreturn cc-imenu-objc-generic-expression-noreturn-index)
704b7ccba694 Imenu support changed.
Richard M. Stallman <rms@gnu.org>
parents: 20507
diff changeset
308 ;; General function name regexp
704b7ccba694 Imenu support changed.
Richard M. Stallman <rms@gnu.org>
parents: 20507
diff changeset
309 (Cgeneralfunc cc-imenu-objc-generic-expression-general-func-index)
704b7ccba694 Imenu support changed.
Richard M. Stallman <rms@gnu.org>
parents: 20507
diff changeset
310 ;; Special case for definitions using phony prototype macros like:
704b7ccba694 Imenu support changed.
Richard M. Stallman <rms@gnu.org>
parents: 20507
diff changeset
311 (Cproto cc-imenu-objc-generic-expression-proto-index)
20134
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
312 langnum
20145
cfd9922ca72b Patches to Imenu support given by
Karl Heuer <kwzh@gnu.org>
parents: 20134
diff changeset
313 ;;
20134
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
314 (classcount 0)
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
315 toplist
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
316 stupid
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
317 str
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
318 str2
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
319 (intflen (length "@interface"))
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
320 (implen (length "@implementation"))
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
321 (prtlen (length "@protocol"))
20916
704b7ccba694 Imenu support changed.
Richard M. Stallman <rms@gnu.org>
parents: 20507
diff changeset
322 (func
704b7ccba694 Imenu support changed.
Richard M. Stallman <rms@gnu.org>
parents: 20507
diff changeset
323 ;;
704b7ccba694 Imenu support changed.
Richard M. Stallman <rms@gnu.org>
parents: 20507
diff changeset
324 ;; Does this emacs has buffer-substring-no-properties?
704b7ccba694 Imenu support changed.
Richard M. Stallman <rms@gnu.org>
parents: 20507
diff changeset
325 ;;
704b7ccba694 Imenu support changed.
Richard M. Stallman <rms@gnu.org>
parents: 20507
diff changeset
326 (if (fboundp 'buffer-substring-no-properties)
704b7ccba694 Imenu support changed.
Richard M. Stallman <rms@gnu.org>
parents: 20507
diff changeset
327 'buffer-substring-no-properties
704b7ccba694 Imenu support changed.
Richard M. Stallman <rms@gnu.org>
parents: 20507
diff changeset
328 'buffer-substring)))
24282
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 23855
diff changeset
329 (goto-char (point-max))
20134
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
330 (imenu-progress-message stupid 0)
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
331 ;;
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
332 (while (re-search-backward cc-imenu-objc-generic-expression nil t)
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
333 (imenu-progress-message stupid)
20145
cfd9922ca72b Patches to Imenu support given by
Karl Heuer <kwzh@gnu.org>
parents: 20134
diff changeset
334 (setq langnum (if (match-beginning OBJC)
cfd9922ca72b Patches to Imenu support given by
Karl Heuer <kwzh@gnu.org>
parents: 20134
diff changeset
335 OBJC
cfd9922ca72b Patches to Imenu support given by
Karl Heuer <kwzh@gnu.org>
parents: 20134
diff changeset
336 (cond
20916
704b7ccba694 Imenu support changed.
Richard M. Stallman <rms@gnu.org>
parents: 20507
diff changeset
337 ((match-beginning Cproto) Cproto)
704b7ccba694 Imenu support changed.
Richard M. Stallman <rms@gnu.org>
parents: 20507
diff changeset
338 ((match-beginning Cgeneralfunc) Cgeneralfunc)
704b7ccba694 Imenu support changed.
Richard M. Stallman <rms@gnu.org>
parents: 20507
diff changeset
339 ((match-beginning Cnoreturn) Cnoreturn))))
704b7ccba694 Imenu support changed.
Richard M. Stallman <rms@gnu.org>
parents: 20507
diff changeset
340 (setq str (funcall func (match-beginning langnum) (match-end langnum)))
20134
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
341 ;;
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
342 (cond
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
343 ;;
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
344 ;; C
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
345 ;;
20145
cfd9922ca72b Patches to Imenu support given by
Karl Heuer <kwzh@gnu.org>
parents: 20134
diff changeset
346 ((not (eq langnum OBJC))
20134
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
347 (setq clist (cons (cons str (match-beginning langnum)) clist)))
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
348 ;;
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
349 ;; ObjC
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
350 ;;
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
351 ;; An instance Method
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
352 ((eq (aref str 0) ?-)
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
353 (setq str (concat "-" (cc-imenu-objc-method-to-selector str)))
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
354 (setq methodlist (cons (cons str
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
355 (match-beginning langnum))
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
356 methodlist)))
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
357 ;; A factory Method
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
358 ((eq (aref str 0) ?+)
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
359 (setq str (concat "+" (cc-imenu-objc-method-to-selector str)))
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
360 (setq methodlist (cons (cons str
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
361 (match-beginning langnum))
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
362 methodlist)))
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
363 ;; Interface or implementation or protocol
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
364 ((eq (aref str 0) ?@)
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
365 (setq classcount (1+ classcount))
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
366 (cond
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
367 ((and (> (length str) implen)
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
368 (string= (substring str 0 implen) "@implementation"))
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
369 (setq str (substring str implen)
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
370 str2 "@implementation"))
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
371 ((string= (substring str 0 intflen) "@interface")
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
372 (setq str (substring str intflen)
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
373 str2 "@interface"))
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
374 ((string= (substring str 0 prtlen) "@protocol")
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
375 (setq str (substring str prtlen)
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
376 str2 "@protocol")))
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
377 (setq str (cc-imenu-objc-remove-white-space str))
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
378 (setq methodlist (cons (cons str2
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
379 (match-beginning langnum))
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
380 methodlist))
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
381 (setq toplist (cons nil (cons (cons str
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
382 methodlist) toplist))
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
383 methodlist nil))))
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
384 ;;
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
385 (imenu-progress-message stupid 100)
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
386 (if (eq (car toplist) nil)
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
387 (setq toplist (cdr toplist)))
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
388
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
389 ;; In this buffer, there is only one or zero @{interface|implementation|protocol}.
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
390 (if (< classcount 2)
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
391 (let ((classname (car (car toplist)))
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
392 (p (cdr (car (cdr (car toplist)))))
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
393 last)
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
394 (setq toplist (cons (cons classname p) (cdr (cdr (car toplist)))))
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
395 ;; Add C lang token
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
396 (if clist
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
397 (progn
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
398 (setq last toplist)
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
399 (while (cdr last)
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
400 (setq last (cdr last)))
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
401 (setcdr last clist))))
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
402 ;; Add C lang tokens as a sub menu
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
403 (setq toplist (cons (cons "C" clist) toplist)))
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
404 ;;
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
405 toplist
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
406 ))
7eb314cf3574 (cc-imenu-c-prototype-macro-regexp): New var.
Karl Heuer <kwzh@gnu.org>
parents: 19809
diff changeset
407
24282
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 23855
diff changeset
408 ;(defvar cc-imenu-pike-generic-expression
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 23855
diff changeset
409 ; ())
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 23855
diff changeset
410 ; FIXME: Please contribute one!
5b0864259a4b Installed CC Mode 5.25.
Barry A. Warsaw <barry@zope.org>
parents: 23855
diff changeset
411
26817
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24783
diff changeset
412 (defun cc-imenu-init (mode-generic-expression)
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24783
diff changeset
413 (setq imenu-generic-expression mode-generic-expression
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24783
diff changeset
414 imenu-case-fold-search nil))
03befb219d03 Installed version 5.26
Gerd Moellmann <gerd@gnu.org>
parents: 24783
diff changeset
415
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
416
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
417 (provide 'cc-menus)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
418 ;;; cc-menus.el ends here