all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Po Lu <luangruo@yahoo.com>, Yuan Fu <casouri@gmail.com>
Cc: 63323@debbugs.gnu.org
Subject: bug#63323: c-ts-mode does not know about `restrict'
Date: Sat, 06 May 2023 13:31:03 +0300	[thread overview]
Message-ID: <834jophhug.fsf@gnu.org> (raw)
In-Reply-To: <87r0rtkh2j.fsf@yahoo.com> (bug-gnu-emacs@gnu.org)

> 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	other threads:[~2023-05-06 10:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <87r0rtkh2j.fsf.ref@yahoo.com>
2023-05-06  8:19 ` bug#63323: c-ts-mode does not know about `restrict' Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-06 10:31   ` Eli Zaretskii [this message]
2023-05-06 12:19     ` Eli Zaretskii
2023-05-06 22:54       ` Yuan Fu
2023-05-07  5:14         ` Eli Zaretskii

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=834jophhug.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=63323@debbugs.gnu.org \
    --cc=casouri@gmail.com \
    --cc=luangruo@yahoo.com \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.