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