;;; cc-menus.el --- imenu support for CC Mode
-;; Copyright (C) 1985, 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
-;; 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
-;; Free Software Foundation, Inc.
+;; Copyright (C) 1985, 1987, 1992-2011 Free Software Foundation, Inc.
;; Authors: 1998- Martin Stjernholm
;; 1992-1999 Barry A. Warsaw
;; 1985 Richard M. Stallman
;; Maintainer: bug-cc-mode@gnu.org
;; Created: 22-Apr-1997 (split from cc-mode.el)
-;; Version: See cc-mode.el
-;; Keywords: c languages oop
+;; Keywords: c languages
+;; Package: cc-mode
;; This file is part of GNU Emacs.
(defvar cc-imenu-c++-generic-expression
`(
;; Try to match ::operator definitions first. Otherwise `X::operator new ()'
- ;; will be incorrectly recognised as function `new ()' because the regexps
+ ;; will be incorrectly recognized as function `new ()' because the regexps
;; work by backtracking from the end of the definition.
(nil
,(concat
"[^" c-alnum "_:<>~]" ; match any non-identifier char
"\\([" c-alpha "_][" c-alnum "_:<>~]*\\)" ; match function name
"\\([ \t\n]\\|\\\\\n\\)*(" ; see above, BUT the arg list
- "\\([ \t\n]\\|\\\\\n\\)*\\([^ \t\n(*][^)]*\\)?)" ; must not start
- "\\([ \t\n]\\|\\\\\n\\)*[^ \t\n;(]" ; with an asterisk or parentheses
+ "\\([ \t\n]\\|\\\\\n\\)*" ; must not start
+ "\\([^ \t\n(*]" ; with an asterisk or parentheses
+ "[^()]*\\(([^()]*)[^()]*\\)*" ; Maybe function pointer arguments
+ "\\)?)"
+ "\\([ \t\n]\\|\\\\\n\\)*[^ \t\n;(]"
) 1)
;; Special case for definitions using phony prototype macros like:
;; `int main _PROTO( (int argc,char *argv[]) )'.
(defvar cc-imenu-java-generic-expression
`((nil
,(concat
- "[" c-alpha "_][\]\[." c-alnum "_]+[ \t\n\r]+" ; type spec
- "\\([" c-alpha "_][" c-alnum "_]+\\)" ; method name
+ "[" c-alpha "_][\]\[." c-alnum "_<> ]+[ \t\n\r]+" ; type spec
+ "\\([" c-alpha "_][" c-alnum "_]*\\)" ; method name
"[ \t\n\r]*"
- ;; An argument list that is either empty or contains at least
- ;; two identifiers with only space between them. This avoids
- ;; matching e.g. "else if (foo)".
- (concat "([ \t\n\r]*"
- "\\([\]\[.," c-alnum "_]+"
- "[ \t\n\r]+"
- "[\]\[.," c-alnum "_]"
- "[\]\[.," c-alnum "_ \t\n\r]*"
- "\\)?)")
- "[.," c-alnum "_ \t\n\r]*"
- "{"
- ) 1))
- "Imenu generic expression for Java mode. See `imenu-generic-expression'.")
+ ;; An argument list htat is either empty or contains any number
+ ;; of arguments. An argument is any number of annotations
+ ;; followed by a type spec followed by a word. A word is an
+ ;; identifier. A type spec is an identifier, possibly followed
+ ;; by < typespec > possibly followed by [].
+ (concat "("
+ "\\("
+ "[ \t\n\r]*"
+ "\\("
+ "@"
+ "[" c-alpha "_]"
+ "[" c-alnum "._]""*"
+ "[ \t\n\r]+"
+ "\\)*"
+ "\\("
+ "[" c-alpha "_]"
+ "[\]\[" c-alnum "_.]*"
+ "\\("
+
+ "<"
+ "[ \t\n\r]*"
+ "[\]\[.," c-alnum "_<> \t\n\r]*"
+ ">"
+ "\\)?"
+ "\\(\\[\\]\\)?"
+ "[ \t\n\r]+"
+ "\\)"
+ "[" c-alpha "_]"
+ "[" c-alnum "_]*"
+ "[ \t\n\r,]*"
+ "\\)*"
+ ")"
+ "[.," c-alnum " \t\n\r]*"
+ "{"
+ )) 1))
+ "Imenu generic expression for Java mode. See
+`imenu-generic-expression'.")
;; *Warning for cc-mode developers*
;;
\f
(cc-provide 'cc-menus)
-;; arch-tag: f6b60933-91f0-4145-ab44-70ca6d1b919b
;;; cc-menus.el ends here