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: Sat, 06 May 2023 13:31:03 +0300

> Date: Sat, 06 May 2023 16:19:32 +0800
> From:  Po Lu via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> 
> Standard C accepts a keyword `restrict', which is used to declare
> pointers whose referenced object must only be accessed by lvalues based
> upon one such pointer within the block where they are declared.
> 
> Like so:
> 
>   argb *restrict src, *restrict dest;
> 
> c-ts-mode does not understand this keyword.  It is not fontified within
> such declarations.

It looks like c-ts-mode thinks type qualifiers are possible only in
C++?

   :feature 'type
   `((primitive_type) @font-lock-type-face
     (type_identifier) @font-lock-type-face
     (sized_type_specifier) @font-lock-type-face
     ,@(when (eq mode 'cpp) <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
         '((type_qualifier) @font-lock-type-face

           (qualified_identifier
            scope: (namespace_identifier) @font-lock-type-face)

           (operator_cast) type: (type_identifier) @font-lock-type-face))
     [,@c-ts-mode--type-keywords] @font-lock-type-face)

The tree-sitter library returns a type_qualifier node for 'restrict':

       (parameter_declaration type: (type_identifier)
        declarator: 
         (pointer_declarator *
          (type_qualifier restrict)
          declarator: (identifier)))

Yuan, can you look into fixing this, please?





reply via email to

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