annotate lisp/cc-mode/cc-menus.el @ 181:bfd6434d15b3 r20-3b17

Import from CVS: tag r20-3b17
author cvs
date Mon, 13 Aug 2007 09:53:19 +0200
parents 6075d714658b
children e121b013d1f0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
171
929b76928fce Import from CVS: tag r20-3b12
cvs
parents: 165
diff changeset
1 ;;; cc-menus.el --- imenu support for CC Mode
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3 ;; Copyright (C) 1985,87,92,93,94,95,96,97 Free Software Foundation, Inc.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
4
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
5 ;; Authors: 1992-1997 Barry A. Warsaw
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
6 ;; 1987 Dave Detlefs and Stewart Clamen
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
7 ;; 1985 Richard M. Stallman
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
8 ;; Maintainer: cc-mode-help@python.org
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
9 ;; Created: 22-Apr-1997 (split from cc-mode.el)
181
bfd6434d15b3 Import from CVS: tag r20-3b17
cvs
parents: 177
diff changeset
10 ;; Version: 5.15
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
11 ;; Keywords: c languages oop
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
12
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
13 ;; This file is part of GNU Emacs.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
14
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
15 ;; GNU Emacs is free software; you can redistribute it and/or modify
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
16 ;; it under the terms of the GNU General Public License as published by
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
17 ;; the Free Software Foundation; either version 2, or (at your option)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
18 ;; any later version.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
19
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
20 ;; GNU Emacs is distributed in the hope that it will be useful,
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
21 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
22 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
23 ;; GNU General Public License for more details.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
24
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
25 ;; You should have received a copy of the GNU General Public License
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
26 ;; along with GNU Emacs; see the file COPYING. If not, write to the
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
27 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
28 ;; Boston, MA 02111-1307, USA.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
29
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
30
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
31 ;; imenu integration
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
32 (defvar cc-imenu-c++-generic-expression
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
33 (`
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
34 ((nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
35 (,
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
36 (concat
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
37 "^" ; beginning of line is required
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
38 "\\(template[ \t]*<[^>]+>[ \t]*\\)?" ; there may be a "template <...>"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
39 "\\([a-zA-Z0-9_:]+[ \t]+\\)?" ; type specs; there can be no
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
40 "\\([a-zA-Z0-9_:]+[ \t]+\\)?" ; more than 3 tokens, right?
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
41
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
42 "\\(" ; last type spec including */&
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
43 "[a-zA-Z0-9_:]+"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
44 "\\([ \t]*[*&]+[ \t]*\\|[ \t]+\\)" ; either ptr/ref sign or ws
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
45 "\\)?" ; if there is a last type spec
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
46 "\\(" ; name, take into the imenu entry
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
47 "[a-zA-Z0-9_:~]+" ; member func, ctor or dtor...
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
48 ; (may not contain * because then
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
49 ; "a::operator char*" would
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
50 ; become "char*"!)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
51 "\\|"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
52 "\\([a-zA-Z0-9_:~]*::\\)?operator"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
53 "[^a-zA-Z1-9_][^(]*" ; ...or operator
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
54 " \\)"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
55 "[ \t]*([^)]*)[ \t\n]*[^ ;]" ; require something other than
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
56 ; a `;' after the (...) to
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
57 ; avoid prototypes. Can't
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
58 ; catch cases with () inside
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
59 ; the parentheses surrounding
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
60 ; the parameters. e.g.:
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
61 ; "int foo(int a=bar()) {...}"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
62
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
63 )) 6)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
64 ("Class"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
65 (, (concat
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
66 "^" ; beginning of line is required
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
67 "\\(template[ \t]*<[^>]+>[ \t]*\\)?" ; there may be a "template <...>"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
68 "class[ \t]+"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
69 "\\([a-zA-Z0-9_]+\\)" ; the string we want to get
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
70 "[ \t]*[:{]"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
71 )) 2)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
72 "Imenu generic expression for C++ mode. See `imenu-generic-expression'.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
73
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
74 (defvar cc-imenu-c-generic-expression
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
75 cc-imenu-c++-generic-expression
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
76 "Imenu generic expression for C mode. See `imenu-generic-expression'.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
77
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
78 ;(defvar cc-imenu-objc-generic-expression
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
79 ; ())
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
80 ; Please contribute one!
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
81
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
82 (defvar cc-imenu-java-generic-expression
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
83 (`
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
84 ((nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
85 (,
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
86 (concat
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
87 "^\\([ \t]\\)*"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
88 "\\([A-Za-z0-9_-]+[ \t]+\\)?" ; type specs; there can be
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
89 "\\([A-Za-z0-9_-]+[ \t]+\\)?" ; more than 3 tokens, right?
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
90 "\\([A-Za-z0-9_-]+[ \t]*[[]?[]]?\\)"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
91 "\\([ \t]\\)"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
92 "\\([A-Za-z0-9_-]+\\)" ; the string we want to get
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
93 "\\([ \t]*\\)+("
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
94 "\\([a-zA-Z,_1-9\n \t]*[[]?[]]?\\)*" ; arguments
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
95 ")[ \t]*"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
96 "[^;(]"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
97 "[,a-zA-Z_1-9\n \t]*{"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
98 )) 6)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
99 "Imenu generic expression for Java mode. See `imenu-generic-expression'.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
100
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
101
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
102 (provide 'cc-menus)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
103 ;;; cc-menus.el ends here