X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/0d3e93a66f621c5229c14df56a31c7f19ed52251..55dc42fcf374b0168d3fda7edca0f24a7bfd4b7b:/lisp/progmodes/cc-menus.el diff --git a/lisp/progmodes/cc-menus.el b/lisp/progmodes/cc-menus.el index b151bd0244..942303b109 100644 --- a/lisp/progmodes/cc-menus.el +++ b/lisp/progmodes/cc-menus.el @@ -1,8 +1,6 @@ ;;; 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 @@ -11,8 +9,8 @@ ;; 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. @@ -68,7 +66,7 @@ A sample value might look like: `\\(_P\\|_PROTO\\)'.") (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 @@ -110,8 +108,11 @@ A sample value might look like: `\\(_P\\|_PROTO\\)'.") "[^" 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[]) )'. @@ -149,22 +150,46 @@ A sample value might look like: `\\(_P\\|_PROTO\\)'.") (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* ;; @@ -418,5 +443,4 @@ Example: (cc-provide 'cc-menus) -;; arch-tag: f6b60933-91f0-4145-ab44-70ca6d1b919b ;;; cc-menus.el ends here