unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Nathaniel Flath <flat0103@gmail.com>
Cc: emacs-devel@gnu.org
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	[thread overview]
Message-ID: <20090822141711.GA3512@muc.de> (raw)
In-Reply-To: <5e3a506e0908162233x47fe9544kcd8fda1738c28e84@mail.gmail.com>

Hi, Nathaniel,

On Sun, Aug 16, 2009 at 10:33:03PM -0700, Nathaniel Flath wrote:
> ---------- Forwarded message ----------
> From: Nathaniel Flath <flat0103@gmail.com>
> 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 <cyd@stupidchicken.com>


> 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<String > fun4() { }
>     Map< String,String > fun5() { }
>     void fun6( @NonNull int a ) { }
>     void fun7( @NonNull int b, @NonNull int c ) { }
>     void fun8( @NonNull List<String> a ) { }
>     void fun9( @NonNull List<List<String >> 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).




  reply	other threads:[~2009-08-22 14:17 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-18 15:27 Minor bug in cc-menus.el: cc-imenu-java-generic-expression does not match all Java 1.5+ function definitions Nathaniel Flath
2009-07-21 20:18 ` Nathaniel Flath
2009-07-24  3:58   ` Glenn Morris
2009-07-28 10:19 ` Alan Mackenzie
2009-07-28 11:42   ` David Kastrup
2009-07-29  3:28   ` Chong Yidong
2009-07-29  4:46     ` Nathaniel Flath
2009-08-07 14:32       ` Nathaniel Flath
     [not found]         ` <5e3a506e0908162232h192a3c28o42e1745f4444b911@mail.gmail.com>
2009-08-17  5:33           ` Fwd: " Nathaniel Flath
2009-08-22 14:17             ` Alan Mackenzie [this message]
2009-08-22 16:48               ` Nathaniel Flath
     [not found]                 ` <jwvr5v3b9ke.fsf-monnier+emacs@gnu.org>
     [not found]                   ` <5e3a506e0909291146w607168e7l578858a741cfa19a@mail.gmail.com>
2009-10-17 16:59                     ` Nathaniel Flath
2009-10-17 23:43                       ` Chong Yidong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090822141711.GA3512@muc.de \
    --to=acm@muc.de \
    --cc=emacs-devel@gnu.org \
    --cc=flat0103@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).