bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#63323: c-ts-mode does not know about `restrict'


From: Eli Zaretskii
Subject: bug#63323: c-ts-mode does not know about `restrict'
Date: Sun, 07 May 2023 08:14:25 +0300

> From: Yuan Fu <casouri@gmail.com>
> Date: Sat, 6 May 2023 15:54:32 -0700
> Cc: luangruo@yahoo.com,
>  63323@debbugs.gnu.org
> 
> 
> 
> > Actually, it looks like we recognize the type qualifiers in C as
> > keywords, via a separate list.  So I've just added to that list the
> > two missing qualifiers: 'restrict' and '_Atomic', and that fixes this
> > bug for me.
> > 
> > Yuan, is that the right fix?  I've installed it on the emacs-29
> > branch.
> 
> I check tree-sitter-c’s grammar and it defines type_qualifier [1], so if you 
> move (type_qualifier) @font-lock-type-face out of the check for cpp, if would 
> work. Recognizing them as keywords also works. So both are technically 
> correct. C-mode uses keyword face, so I think your fix is a-ok.
> 
> [1] you probably know this, but for completeness:
> 
>     type_qualifier: $ => choice(
>       'const',
>       'volatile',
>       'restrict',
>       '_Atomic'
>     ),

Right, they just copied from the C Standard.

Whether we want to stay with qualifiers in keywords or not depends on
whether we thing type qualifiers could or should be fontified
differently from keywords.  (What do other IDEs do with C type
qualifiers?)  Something to think for the future, I guess.

For now, I'm closing this bug.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]