From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: RFR cc-langs.el: change syntax for @ in Java Date: Tue, 13 Apr 2021 10:28:46 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33268"; mail-complaints-to="usenet@ciao.gmane.io" To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Apr 13 12:29:38 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lWGIc-0008YH-0q for ged-emacs-devel@m.gmane-mx.org; Tue, 13 Apr 2021 12:29:38 +0200 Original-Received: from localhost ([::1]:54348 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lWGIb-0006d9-2u for ged-emacs-devel@m.gmane-mx.org; Tue, 13 Apr 2021 06:29:37 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48278) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lWGHs-00062v-TC for emacs-devel@gnu.org; Tue, 13 Apr 2021 06:28:52 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:53545 helo=mail.muc.de) by eggs.gnu.org with smtp (Exim 4.90_1) (envelope-from ) id 1lWGHq-0006eA-4w for emacs-devel@gnu.org; Tue, 13 Apr 2021 06:28:52 -0400 Original-Received: (qmail 70270 invoked by uid 3782); 13 Apr 2021 10:28:47 -0000 Original-Received: from acm.muc.de (p4fe15996.dip0.t-ipconnect.de [79.225.89.150]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Tue, 13 Apr 2021 12:28:47 +0200 Original-Received: (qmail 10436 invoked by uid 1000); 13 Apr 2021 10:28:46 -0000 Content-Disposition: inline In-Reply-To: X-Submission-Agent: TMDA/1.3.x (Ph3nix) X-Primary-Address: acm@muc.de Received-SPF: pass client-ip=193.149.48.1; envelope-from=acm@muc.de; helo=mail.muc.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:267994 Archived-At: 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).