GNU bug report logs - #63840
29.0.91; c-ts-mode fails to fontify common C extension

Previous Next

Package: emacs;

Reported by: Po Lu <luangruo <at> yahoo.com>

Date: Fri, 2 Jun 2023 12:12:01 UTC

Severity: normal

Tags: notabug

Found in version 29.0.91

Done: Stefan Kangas <stefankangas <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Yuan Fu <casouri <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Po Lu <luangruo <at> yahoo.com>, 63840 <at> debbugs.gnu.org, Theodor Thornhill <theo <at> thornhill.no>
Subject: bug#63840: 29.0.91; c-ts-mode fails to fontify common C extension
Date: Thu, 8 Jun 2023 00:18:17 -0700

> On Jun 2, 2023, at 5:51 AM, Eli Zaretskii <eliz <at> gnu.org> wrote:
> 
>> Date: Fri, 02 Jun 2023 20:11:33 +0800
>> From:  Po Lu via "Bug reports for GNU Emacs,
>> the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
>> 
>> A common extension to the C language is the use of the `$' sign inside
>> external identifier names.
>> 
>> This is permitted by GNU CC on most systems it supports, and also
>> supported by CC Mode.  However, it does not work on c-ts-mode:
>> 
>> sl$loadarena ()
>> {
>>  struct FAB fab;
>>  register int status;
>>  extern char *sl$dfname;
>> 
>>  fab = cc$rms_fab;
>>  fab.fab$b_fac = FAB$M_BIO | FAB$M_GET;
>>  fab.fab$l_fna = sl$dfname;
>>  fab.fab$b_fns = strlen (sl$dfname);
>>  status = sys$open (&fab);
>>  if (status != RMS$_NORMAL)
>>    return status;
>>  /* More code below.  */
>> }
>> 
>> in the identifier name of this function declarator, `sl' is fontified as
>> a type.  `$' is not fontified at all.  `loadarena' is fontified as an
>> identifier name, as it should be.  In:
>> 
>>  extern char *sl$defname;
>> 
>> only `dfname' is fontified as a variable name; in CC Mode, all
>> fontification is correct.
>> 
>> This should be a simple change in c-ts-mode's identifier fontifying
>> regexp to include `$', right?  I don't know enough about tree-sitter to
>> fix it myself.
> 
> I'm not sure this can be fixed unless the tree-sitter's C grammar
> supports such identifiers, but if we can fix it in our code, we
> should.
> 
> Yuan and Theo, can you please look into this?

Yeah. So is this the only way $ is used in C? Could it appear in contexts other than identifiers?

Yuan



This bug report was last modified 1 year and 236 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.