From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Nathaniel Flath Newsgroups: gmane.emacs.devel Subject: Fwd: Minor bug in cc-menus.el: cc-imenu-java-generic-expression does not match all Java 1.5+ function definitions. Date: Sun, 16 Aug 2009 22:33:03 -0700 Message-ID: <5e3a506e0908162233x47fe9544kcd8fda1738c28e84@mail.gmail.com> 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> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=000e0cd151f864e45504714fbc2c X-Trace: ger.gmane.org 1250487212 26257 80.91.229.12 (17 Aug 2009 05:33:32 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 17 Aug 2009 05:33:32 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Aug 17 07:33:25 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 1McuqS-0003wc-Ly for ged-emacs-devel@m.gmane.org; Mon, 17 Aug 2009 07:33:25 +0200 Original-Received: from localhost ([127.0.0.1]:55779 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1McuqR-0006pt-RA for ged-emacs-devel@m.gmane.org; Mon, 17 Aug 2009 01:33:23 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1McuqG-0006pI-1H for emacs-devel@gnu.org; Mon, 17 Aug 2009 01:33:12 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1McuqA-0006oP-Ev for emacs-devel@gnu.org; Mon, 17 Aug 2009 01:33:10 -0400 Original-Received: from [199.232.76.173] (port=39891 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1McuqA-0006oM-3E for emacs-devel@gnu.org; Mon, 17 Aug 2009 01:33:06 -0400 Original-Received: from rv-out-0708.google.com ([209.85.198.248]:24103) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Mcuq9-00073E-Ep for emacs-devel@gnu.org; Mon, 17 Aug 2009 01:33:05 -0400 Original-Received: by rv-out-0708.google.com with SMTP id f25so1038353rvb.6 for ; Sun, 16 Aug 2009 22:33:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=IJTLpfvfiVSdTcVIF5XDtmGV14DNY2HhH5KK9NX03PI=; b=dC4dL1eomxkcDPJcI2nBrLwX8SpIfKQlzSSIH8TAN4lNf4ddG2HHFUHYRWWahyiDda 3+6V+blkOOalwGSfg179zQYXHLutmV3sc+yP6I+/lgmLfmBJo/mAOQ5IbaPOqSpB5A1O qATMJHyjxKfkJcjDK+flEwEdIsDPpeTZJ3rRQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=iDCn83SyZZr7Pjujsz92gv/pmi1tAGC9xkpgE5M0W5eBcnwDs//A6mVC8aNmSMJi1u e+4gtSEGyUFcUpgqCQHpiMtMUhPBf+X1ff1XAJUIU5u9gWuZFwVGcf+oiqMq+V3bxWUO aHyzYrizbn+LBGK7rntalnp06UkX498R2Dnlc= Original-Received: by 10.140.202.12 with SMTP id z12mr2087605rvf.294.1250487183925; Sun, 16 Aug 2009 22:33:03 -0700 (PDT) In-Reply-To: <5e3a506e0908162232h192a3c28o42e1745f4444b911@mail.gmail.com> X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) 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:114334 Archived-At: --000e0cd151f864e45504714fbc2c Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit ---------- 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. On Fri, Aug 7, 2009 at 7:32 AM, Nathaniel Flath wrote: > Just pinging this out again. > > > On Tue, Jul 28, 2009 at 9:46 PM, Nathaniel Flath wrote: > >> There did turn out to be a few problems with that regexp - the updated one >> is: >> >> (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 >> >> >> On Tue, Jul 28, 2009 at 8:28 PM, Chong Yidong wrote: >> >>> Alan Mackenzie writes: >>> >>> > OK. I've not looked at it in all that great detail, and haven't tried >>> > it out yet. I'm not actually a Java hacker. >>> > >>> > How confident are you that your proposed regexp won't spuriously match >>> > things with "less than" or "greater than" tokens? Or, if it will, >>> would >>> > these matches be rare enough that we needn't worry too much? >>> > >>> > Is there any chance you could send me a test file showing a typical >>> > generic construct that the new regexp would match, and possibly >>> > constructs with "less/greater than" which it "doesn't quite" match? >>> >>> By the way, it might be good to accumulate a test suite for CC mode, >>> along the lines of etc/compilation.txt. I don't know if you already >>> have something like that; if so, we can put it in the new test/ >>> directory. >>> >>> (We should probably move etc/compilation into test/ also.) >>> >> >> > --000e0cd151f864e45504714fbc2c Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable

---------- Forwarded message ----------<= br>From: Nathaniel Flath <flat0103@gmail.com>
Date: Sun, Aug 16, 2009 at 10:32 PM
Subject: Re: Minor bug in cc-menus.e= l: cc-imenu-java-generic-expression does not match all Java 1.5+ function d= efinitions.
To: Chong Yidong <cyd@stupidchicken.com>


And again.


On Fri, Aug 7, 2009 at 7:32 AM, Nathaniel Flath <flat0103@gma= il.com> wrote:
Just pinging this out again.


On Tue, Jul 28, 2009 at 9:46 PM, Nathaniel Flath <flat0103@gmail= .com> wrote:
There did turn out to be a few problems with that regexp - the updated one = is:

(defvar cc-imenu-java-generic-expression
=A0 `((nil
=A0=A0= =A0=A0 ,(concat
=A0=A0=A0=A0=A0=A0 "[" c-alpha "_][\]\[.&= quot; c-alnum "_<> ]+[ \t\n\r]+" ; type spec
=A0=A0=A0=A0=A0=A0 "\\([" c-alpha "_][" c-alnum "_= ]+\\)" ; method name
=A0=A0=A0=A0=A0=A0 "[ \t\n\r]*"
= =A0=A0=A0=A0=A0=A0 ;; An argument list htat is either empty or contains any= number
=A0=A0=A0=A0=A0=A0 ;; of arguments.=A0 An argument is any number= of annotations
=A0=A0=A0=A0=A0=A0 ;; followed by a type spec followed by a word.=A0 A word= is an
=A0=A0=A0=A0=A0=A0 ;; identifier.=A0 A type spec is an identifier= , possibly followed
=A0=A0=A0=A0=A0=A0 ;; by < typespec > possibly= followed by [].
=A0=A0=A0=A0=A0=A0 (concat "("
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 "\\("
=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 "[ \t\n\r]*"
=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 "\\("
=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 "@"
=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 "[" c-alpha &= quot;_]"
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0 "[" c-alnum "._]""*"
=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A0=A0=A0= =A0=A0=A0 "\\)"
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0 "[" c-alpha "_]"
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 "[" c-alnum &quo= t;_]*"
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 "[ \t\= n\r,]*"
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 "\\)*"=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ")"
=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0 "[ \t\n\r]*"
=A0=A0=A0=A0=A0=A0 "{&quo= t;
=A0=A0=A0=A0=A0=A0 )) 1))
=A0 "Imenu generic expression for Java mo= de.=A0 See `imenu-generic-expression'.")

I ended up just sp= litting out the annotations from the type from the identifier name to make = it easier in the argument list.=A0 A file that displays some of the matches= /non-matches is:

//(setq imenu-generic-expression cc-imenu-java-generic-expression)
<= br>public class Test {

=A0=A0=A0 void fun1() { }
=A0=A0=A0 void f= un2( int a ) { }
=A0=A0=A0 void fun3( int a, int b ) { }
=A0=A0=A0 Li= st<String > fun4() { }
=A0=A0=A0 Map< String,String > fun5() { }
=A0=A0=A0 void fun6( @No= nNull int a ) { }
=A0=A0=A0 void fun7( @NonNull int b, @NonNull int c ) = { }
=A0=A0=A0 void fun8( @NonNull List<String> a ) { }
=A0=A0= =A0 void fun9( @NonNull List<List<String >> a ) { }
=A0=A0=A0 void fun10( @NonNull int[] a) { }
=A0=A0=A0 void fun11( List&l= t; class.innerclass > foo ) { }
=A0=A0=A0 voif fun12( class.innerclas= s< Integer> foof ) { }

=A0=A0=A0 else if( a ) { }
=A0=A0=A0= else if( a < b ) { }
=A0=A0=A0 else if( a < b && b > a ) { }
=A0=A0=A0 else if(= =A0 a ) { }
=A0=A0=A0 else if( a.b ) { }
}

the 'funX' = should all be matched, with no 'else if's

<= br>
On Tue, Jul 28, 2009 at 8:28 PM, Chong Yidong <cyd@stupidchicken.com> wrote:
> OK. =A0I've not looked at it in all that great detail, = and haven't tried
> it out yet. =A0I'm not actually a Java hacker.
>
> How confident are you that your proposed regexp won't spuriously m= atch
> things with "less than" or "greater than" tokens? = =A0Or, if it will, would
> these matches be rare enough that we needn't worry too much?
>
> Is there any chance you could send me a test file showing a typical > generic construct that the new regexp would match, and possibly
> constructs with "less/greater than" which it "doesn'= ;t quite" match?

By the way, it might be good to accumulate a test suite for CC mode,<= br> along the lines of etc/compilation.txt. =A0I don't know if you already<= br> have something like that; if so, we can put it in the new test/
directory.

(We should probably move etc/compilation into test/ also.)




--000e0cd151f864e45504714fbc2c--