From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuan Fu Newsgroups: gmane.emacs.bugs Subject: bug#63323: c-ts-mode does not know about `restrict' Date: Sat, 6 May 2023 15:54:32 -0700 Message-ID: <61B53D25-0E51-4B4C-9890-10E9B97E1840@gmail.com> References: <87r0rtkh2j.fsf.ref@yahoo.com> <87r0rtkh2j.fsf@yahoo.com> <834jophhug.fsf@gnu.org> <83v8h5fya0.fsf@gnu.org> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.500.231\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32479"; mail-complaints-to="usenet@ciao.gmane.io" Cc: luangruo@yahoo.com, 63323@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun May 07 00:55:25 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1pvQoH-0008FW-Lu for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 07 May 2023 00:55:25 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pvQnw-0005zt-Dl; Sat, 06 May 2023 18:55:04 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pvQnu-0005zT-9Q for bug-gnu-emacs@gnu.org; Sat, 06 May 2023 18:55:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pvQnu-0006k7-0M for bug-gnu-emacs@gnu.org; Sat, 06 May 2023 18:55:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pvQnt-0002qr-Su for bug-gnu-emacs@gnu.org; Sat, 06 May 2023 18:55:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 06 May 2023 22:55:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63323 X-GNU-PR-Package: emacs Original-Received: via spool by 63323-submit@debbugs.gnu.org id=B63323.168341369610923 (code B ref 63323); Sat, 06 May 2023 22:55:01 +0000 Original-Received: (at 63323) by debbugs.gnu.org; 6 May 2023 22:54:56 +0000 Original-Received: from localhost ([127.0.0.1]:35951 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pvQno-0002q6-CK for submit@debbugs.gnu.org; Sat, 06 May 2023 18:54:56 -0400 Original-Received: from mail-pf1-f174.google.com ([209.85.210.174]:48257) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pvQnk-0002oy-Gn for 63323@debbugs.gnu.org; Sat, 06 May 2023 18:54:54 -0400 Original-Received: by mail-pf1-f174.google.com with SMTP id d2e1a72fcca58-643846c006fso3477525b3a.0 for <63323@debbugs.gnu.org>; Sat, 06 May 2023 15:54:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683413686; x=1686005686; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=WkrJ1LZ1cg0gwHrv7rX1HiTqQBo3qhhAkBozwegUEMs=; b=fmU+tweL2DnDYJFkHOJ6sboDWh8Jjx/CEkISbyW0U4Q0FLtcvczWO4nwQxs/ugANVe s47FjKVvb54LW3DMxNwFASC4Ku6lA9gBZLjo1kwQ8mg8A58nunlPSxdynD8W7abhjJg9 zIuQ6Z+pVd4Xr7IXUIvxHfHB41UCn+cvZ6Fz8KRh8uyq10Z0F+R7UBYWw/hEC7jBBGnX uG+MNz0tlfPHwsoxy24GF8CnYdvhmW1dqXtG98FDwHcHHjVZvAjytMh6NDDOIdLRO+lL 0YZBbiODImvSerCH7JA48WII+0yru41S1ggLNe8RsAWhzRWqwRiX1qt8gY+VwGOrrV0t qNHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683413686; x=1686005686; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WkrJ1LZ1cg0gwHrv7rX1HiTqQBo3qhhAkBozwegUEMs=; b=LXlbUvuGIR85ARcZrJhmCvNm7Vrl1dCVGc9USFsr4E3hYMn11HCbLcPvniwiGRVp6Z 7J5frdu9XEwagpBr3NuesDY0cNiDlnT7kcPnfUz0ppk3a3Vb9/D5/sd8v8bXVf+0kr7r GKXnbOZm89Bmbf8naMvwDtaeGxbQX5+rcuy1GJjdexjFfWES2hNZGPQP0DYFwKhB4/tC FYmF5lCRYB6T3+mcylVy7rdSm+lqeSc7NAixXLo4W/1z/YJYrMtOOYZCdfFK9pWrJp2S tD/U2bf72zH3LgfTCQ8p6NuORBrU7hHZzAact4pGA9o5U9okQmiIHI/FDF4VCu2smEZx 6FCw== X-Gm-Message-State: AC+VfDw/G3/QKib+NsxUv265Vb28GujHsKaUFJMy8olnMFfMeX+c021f KCts2O5AdkJrQyBWO+gB5Dg= X-Google-Smtp-Source: ACHHUZ5D1ibfkVRrKFhHoq/0A5Ta11wfp5UZzujsAcKoqpN2NS2unRbX96a8RvzCcQEdDuO6mvzLhg== X-Received: by 2002:a05:6a21:920d:b0:f8:ea21:7c37 with SMTP id tl13-20020a056a21920d00b000f8ea217c37mr6835391pzb.20.1683413686309; Sat, 06 May 2023 15:54:46 -0700 (PDT) Original-Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id s21-20020a63dc15000000b0052c53577756sm3594939pgg.64.2023.05.06.15.54.45 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 06 May 2023 15:54:45 -0700 (PDT) In-Reply-To: <83v8h5fya0.fsf@gnu.org> X-Mailer: Apple Mail (2.3731.500.231) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:261223 Archived-At: > On May 6, 2023, at 5:19 AM, Eli Zaretskii wrote: >=20 >> Cc: 63323@debbugs.gnu.org >> Date: Sat, 06 May 2023 13:31:03 +0300 >> From: Eli Zaretskii >>=20 >> It looks like c-ts-mode thinks type qualifiers are possible only in >> C++? >>=20 >> :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 >>=20 >> (qualified_identifier >> scope: (namespace_identifier) @font-lock-type-face) >>=20 >> (operator_cast) type: (type_identifier) = @font-lock-type-face)) >> [,@c-ts-mode--type-keywords] @font-lock-type-face) >>=20 >> The tree-sitter library returns a type_qualifier node for 'restrict': >>=20 >> (parameter_declaration type: (type_identifier) >> declarator:=20 >> (pointer_declarator * >> (type_qualifier restrict) >> declarator: (identifier))) >>=20 >> Yuan, can you look into fixing this, please? >=20 > 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. >=20 > Yuan, is that the right fix? I've installed it on the emacs-29 > branch. I check tree-sitter-c=E2=80=99s 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: $ =3D> choice( 'const', 'volatile', 'restrict', '_Atomic' ), Yuan=