From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: Fwd: Minor bug in cc-menus.el: cc-imenu-java-generic-expression does not match all Java 1.5+ function definitions. Date: Sat, 22 Aug 2009 14:17:11 +0000 Message-ID: <20090822141711.GA3512@muc.de> References: <5e3a506e0907180827k148fe0d1x34b89f1fedf6c79d@mail.gmail.com> <20090728101959.GA2295@muc.de> <871vo05fsl.fsf@cyd.mit.edu> <5e3a506e0907282146x549f9f8bt3412603ec86b7691@mail.gmail.com> <5e3a506e0908070732yc0095d5gfe72101b8843037e@mail.gmail.com> <5e3a506e0908162232h192a3c28o42e1745f4444b911@mail.gmail.com> <5e3a506e0908162233x47fe9544kcd8fda1738c28e84@mail.gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1250950477 16679 80.91.229.12 (22 Aug 2009 14:14:37 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 22 Aug 2009 14:14:37 +0000 (UTC) Cc: emacs-devel@gnu.org To: Nathaniel Flath Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Aug 22 16:14:30 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MerMU-0001Cb-9j for ged-emacs-devel@m.gmane.org; Sat, 22 Aug 2009 16:14:30 +0200 Original-Received: from localhost ([127.0.0.1]:48217 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MerMT-0007Xs-Jm for ged-emacs-devel@m.gmane.org; Sat, 22 Aug 2009 10:14:29 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MerMM-0007Xa-Pt for emacs-devel@gnu.org; Sat, 22 Aug 2009 10:14:22 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MerMH-0007Ww-6F for emacs-devel@gnu.org; Sat, 22 Aug 2009 10:14:21 -0400 Original-Received: from [199.232.76.173] (port=37832 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MerMH-0007Wt-3x for emacs-devel@gnu.org; Sat, 22 Aug 2009 10:14:17 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:1469 helo=mail.muc.de) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MerMG-0006j2-Mg for emacs-devel@gnu.org; Sat, 22 Aug 2009 10:14:17 -0400 Original-Received: (qmail 21523 invoked by uid 3782); 22 Aug 2009 14:14:14 -0000 Original-Received: from acm.muc.de (pD9E52BA4.dip.t-dialin.net [217.229.43.164]) by colin2.muc.de (tmda-ofmipd) with ESMTP; Sat, 22 Aug 2009 16:14:13 +0200 Original-Received: (qmail 5894 invoked by uid 1000); 22 Aug 2009 14:17:11 -0000 Content-Disposition: inline In-Reply-To: <5e3a506e0908162233x47fe9544kcd8fda1738c28e84@mail.gmail.com> User-Agent: Mutt/1.5.9i X-Delivery-Agent: TMDA/1.1.5 (Fettercairn) X-Primary-Address: acm@muc.de X-detected-operating-system: by monty-python.gnu.org: FreeBSD 4.6-4.9 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:114515 Archived-At: Hi, Nathaniel, On Sun, Aug 16, 2009 at 10:33:03PM -0700, Nathaniel Flath wrote: > ---------- Forwarded message ---------- > From: Nathaniel Flath > Date: Sun, Aug 16, 2009 at 10:32 PM > Subject: Re: Minor bug in cc-menus.el: cc-imenu-java-generic-expression does > not match all Java 1.5+ function definitions. > To: Chong Yidong > And again. Sorry. I've had some heavy personal stuff to deal with in the last few weeks. None of us actually gets paid for maintaining Emacs. I'm still not fully up to scratch for doing software. Also, it looks like your change is quite a substantial one, so I'll have to ask you to sign (paper) copyright assignment forms (to the Free Software Foundation) before installing it into CC Mode. Or have you already been through this? This is standard FSF policy, and though ostensibly you're giving something away, in reality you're not. You retain the right to do as you wish with your own stuff, but you get the protection of FSF's lawyers should anybody ever violate your copyright. > There did turn out to be a few problems with that regexp - the updated > one is: Could you tell me please what those problems were (perhaps with a fragment of Java source where the problems became apparent). > (defvar cc-imenu-java-generic-expression > `((nil > ,(concat > "[" c-alpha "_][\]\[." c-alnum "_<> ]+[ \t\n\r]+" ; type spec > "\\([" c-alpha "_][" c-alnum "_]+\\)" ; method name > "[ \t\n\r]*" > ;; 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,]*" > "\\)*" > ")" > "[ \t\n\r]*" > "{" > )) 1)) > "Imenu generic expression for Java mode. See > `imenu-generic-expression'.") > I ended up just splitting out the annotations from the type from the > identifier name to make it easier in the argument list. A file that > displays some of the matches/non-matches is: > //(setq imenu-generic-expression cc-imenu-java-generic-expression) > public class Test { > void fun1() { } > void fun2( int a ) { } > void fun3( int a, int b ) { } > List fun4() { } > Map< String,String > fun5() { } > void fun6( @NonNull int a ) { } > void fun7( @NonNull int b, @NonNull int c ) { } > void fun8( @NonNull List a ) { } > void fun9( @NonNull List> a ) { } > void fun10( @NonNull int[] a) { } > void fun11( List< class.innerclass > foo ) { } > voif fun12( class.innerclass< Integer> foof ) { } > else if( a ) { } > else if( a < b ) { } > else if( a < b && b > a ) { } > else if( a ) { } > else if( a.b ) { } > } > the 'funX' should all be matched, with no 'else if's OK. Again, how sure are you that the new regexp won't spuriously match things with "less than" or "greater than" tokens? Thanks for taking the trouble with this patch, despite all the tedium I've been causing you. -- Alan Mackenzie (Nuremberg, Germany).