unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: emacs-devel@gnu.org
Subject: Re: RFR cc-langs.el: change syntax for @ in Java
Date: Tue, 13 Apr 2021 10:28:46 +0000	[thread overview]
Message-ID: <YHVyXnsLnssUOBdv@ACM> (raw)
In-Reply-To: <m2k0p7z9u4.fsf@fastmail.fm>

Hello, Filipp.

On Mon, Apr 12, 2021 at 20:33:39 +0300, Filipp Gunbin wrote:
> Hi Alan,

> On 12/04/2021 13:36 +0000, Alan Mackenzie wrote:

> > I've had a more thorough look at it.  In cc-langs.el, there are several
> > places where @ is treated as a symbol character, namely:

> I've checked those places before submitting the patch, and I think they
> should stay without change.

OK, thanks!

> > L375: c-make-mode-syntax-table (which you have proposed modifying)
> > L419: c-identifier-syntax-modifications
> > L636: c-symbol-start

> I see no problem in leaving them as-is, because they will just continue
> to match @ with the following chars as a whole.  It's just when you need
> more fine-grained distinction, then you could check if it's prefix or
> symbol.

> Prefix syntax is defined so that prefix chars are part of the following
> expression, that's exactly the case of Java annotations.

Prefix syntax hasn't been used in CC Mode up till now, so it will be
something of an experiment.

> > L1969: c-paragraph-start (I think this one only applies in comments)

> Yes, this is for javadoc tags, which start with @, and appear only in
> comments, like:

> /**
>  * @param my-param ..
>  */

> > L2198: c-class-decl-kwds (The "@interface" keyword)

> @interface is a keyword which declares the annotation interface itself.

> I would really hope that syntax tables do not affect parsing/matching of
> keywords.  If they don't, then this place doesn't need to be changed,
> either.

> > We need to consider whether to amend some or all of these places, so
> > that @ ceases to be a (starting) character of an identifier.

> I don't think it should cease to be.

OK.

> > I'm also a bit worried that in

> >     @NonNull
> >     @TestClass
> >     @FooBar
> >     public class Annotations {

> > , the last line gets parsed as ((annotation-top-cont 21)), where it
> > really ought to be a topmost-intro.  But this problem is present without
> > your patch, anyway.

> > In summary, I think the motivation for the change (highlighting symbols
> > correctly) is valid, but the change is going to be more involved than
> > the patch you've supplied.

This is, I'm sure, a separate problem.

> It's not about highlighting, but rather about "extracting" @, to be able
> to request the non-@ part separately.

> But maybe I'm missing something.

You've just told me you've looked into things more thoroughly than you
told me before.  Thanks!

I now agree with you that we should commit this change, both to CC Mode
and to Emacs.  Do you want me to do this (with your name), or would you
prefer to do it yourself (at least in Emacs)?

> Thanks.
> Filipp

-- 
Alan Mackenzie (Nuremberg, Germany).



  reply	other threads:[~2021-04-13 10:28 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-07 20:41 RFR cc-langs.el: change syntax for @ in Java Filipp Gunbin
2021-04-08  9:29 ` Alan Mackenzie
2021-04-08 10:15 ` Alan Mackenzie
2021-04-08 11:31   ` Filipp Gunbin
2021-04-08 17:26   ` Filipp Gunbin
2021-04-12 13:36     ` Alan Mackenzie
2021-04-12 17:33       ` Filipp Gunbin
2021-04-13 10:28         ` Alan Mackenzie [this message]
2021-04-13 14:45           ` Filipp Gunbin
2021-04-14 19:55             ` Alan Mackenzie
2021-04-14 21:31               ` Ergus
2021-04-15 14:42               ` Filipp Gunbin

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=YHVyXnsLnssUOBdv@ACM \
    --to=acm@muc.de \
    --cc=emacs-devel@gnu.org \
    /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).