Mercurial > emacs
changeset 20145:cfd9922ca72b
Patches to Imenu support given by
"Masatake (jet) YAMATO" <masata-y@is.aist-nara.ac.jp>.
author | Karl Heuer <kwzh@gnu.org> |
---|---|
date | Thu, 23 Oct 1997 07:49:06 +0000 |
parents | 56d81cc7b4f5 |
children | d7ea5d1fa91b |
files | lisp/progmodes/cc-menus.el |
diffstat | 1 files changed, 58 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/progmodes/cc-menus.el Thu Oct 23 07:48:50 1997 +0000 +++ b/lisp/progmodes/cc-menus.el Thu Oct 23 07:49:06 1997 +0000 @@ -7,7 +7,7 @@ ;; 1985 Richard M. Stallman ;; Maintainer: cc-mode-help@python.org ;; Created: 22-Apr-1997 (split from cc-mode.el) -;; Version: 5.18 +;; Version: See cc-mode.el ;; Keywords: c languages oop ;; This file is part of GNU Emacs. @@ -80,6 +80,17 @@ "\\([a-zA-Z_][a-zA-Z0-9_:<>~]*\\)" ; match function name "[ \t]*([^)]*)[ \t]*[^ \t;]" ; see above )) 1) + ;; General function name regexp + (nil + (, + (concat + "^\\<.*" ; line MUST start with word char + "[^a-zA-Z0-9_:<>~]" ; match any non-identifier char + "\\([a-zA-Z_][a-zA-Z0-9_:<>~]*\\)" ; match function name + "[ \t]*(" ; see above, BUT + "[ \t]*[^ \t(][^)]*)[ \t]*[^ \t;]" ; the argument list must not start + ; with a parentheses + )) 1) ;; Special case for definitions using phony prototype macros like: ;; `int main _PROTO( (int argc,char *argv[]) )'. ;; This case is only included if cc-imenu-c-prototype-macro-regexp is set. @@ -94,17 +105,8 @@ "[ \t]*" ; whitespace before macro name cc-imenu-c-prototype-macro-regexp "[ \t]*(" ; ws followed by first paren. - "[ \t]*([^)]*)[ \t]*[^ \t;]" ; see above + "[ \t]*([^)]*)[ \t]*)[ \t]*[^ \t;]" ; see above )) 1))))) - ;; General function name regexp - (nil - (, - (concat - "^\\<.*" ; line MUST start with word char - "[^a-zA-Z0-9_:<>~]" ; match any non-identifier char - "\\([a-zA-Z_][a-zA-Z0-9_:<>~]*\\)" ; match function name - "[ \t]*([^)]*)[ \t]*[^ \t;]" ; see above - )) 1) ;; Class definitions ("Class" (, (concat @@ -141,11 +143,31 @@ (defvar cc-imenu-objc-generic-expression (concat + ;; ;; For C - ;; Pick a token by (match-string 6) - (car (cdr (car cc-imenu-c++-generic-expression))) + ;; *Warning for developers* + ;; This expression elements depend on `cc-imenu-c++-generic-expression'. + ;; + ;; > Special case to match a line like `main() {}' + ;; > e.g. no return type, not even on the previous line. + ;; Pick a token by (match-string 1) + (car (cdr (nth 1 cc-imenu-c++-generic-expression))) ; + "\\|" + ;; > General function name regexp + ;; Pick a token by (match-string 2) + (car (cdr (nth 2 cc-imenu-c++-generic-expression))) + ;; > Special case for definitions using phony prototype macros like: + ;; > `int main _PROTO( (int argc,char *argv[]) )'. + ;; Pick a token by (match-string 3) + (if cc-imenu-c-prototype-macro-regexp + (concat + "\\|" + (car (cdr (nth 3 cc-imenu-c++-generic-expression)))) + "") + ;; ;; For Objective-C - ;; Pick a token by (match-string 8) + ;; Pick a token by (match-string 3 or 4) + ;; "\\|\\(" "^[-+][:a-zA-Z0-9()*_<>\n\t ]*[;{]" ; Methods "\\|" @@ -227,9 +249,22 @@ "imenu supports for objc-mode." (let (methodlist clist - (C 6) - (OBJC 8) + ;; + ;; OBJC, C1, C2, C3 are constants. + ;; + ;; *Warning for developers* + ;; These constants depend on `cc-imenu-c++-generic-expression'. + ;; + (OBJC + (if cc-imenu-c-prototype-macro-regexp 4 3)) + (C1 ; > Special case to match a line like `main() {}' + 1) + (C2 ; > General function name regexp + 2) + (C3 ; > Special case for definitions using phony prototype macros like: + 3) langnum + ;; (classcount 0) toplist stupid @@ -250,14 +285,19 @@ ;; (while (re-search-backward cc-imenu-objc-generic-expression nil t) (imenu-progress-message stupid) - (setq langnum (if (match-beginning C) C OBJC)) + (setq langnum (if (match-beginning OBJC) + OBJC + (cond + ((match-beginning C3) C3) + ((match-beginning C2) C2) + ((match-beginning C1) C1)))) (setq str (bufsubst-fun (match-beginning langnum) (match-end langnum))) ;; (cond ;; ;; C ;; - ((eq langnum C) + ((not (eq langnum OBJC)) (setq clist (cons (cons str (match-beginning langnum)) clist))) ;; ;; ObjC