From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Theodor Thornhill Newsgroups: gmane.emacs.devel Subject: Re: Tree sitter support for C-like languages Date: Mon, 21 Nov 2022 12:15:23 +0100 Message-ID: <87cz9g8sok.fsf@thornhill.no> References: <87tu36em9t.fsf@thornhill.no> <33EE9B30-C6EC-48D1-BEAF-ABAA1350C870@gmail.com> <87tu2y4qhq.fsf@thornhill.no> <0D2879BC-E8B4-40DA-9D6B-990D408D2409@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24419"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Yuan Fu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Nov 21 12:16:28 2022 Return-path: Envelope-to: ged-emacs-devel@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 1ox4mq-00069g-DA for ged-emacs-devel@m.gmane-mx.org; Mon, 21 Nov 2022 12:16:28 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ox4m1-0001MM-MZ; Mon, 21 Nov 2022 06:15:37 -0500 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 1ox4m0-0001M7-DW for emacs-devel@gnu.org; Mon, 21 Nov 2022 06:15:36 -0500 Original-Received: from out0.migadu.com ([2001:41d0:2:267::]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ox4lv-0001m1-GC for emacs-devel@gnu.org; Mon, 21 Nov 2022 06:15:35 -0500 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1669029328; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=z4ui69Ob9jsGWCzvItcTO5srIatYBM+Jc42qny900Fk=; b=Jo9aySo3xtcmVoL1Mxi3ebgWBDSb+JrwCQtt3l4QLGyAvptv2nOIRQn/9mFAnU7zmnhWO+ QprAzpWNOemNUstSQkCNjyTW1p922dq1ZGVyLNIsy+xGKiT2lAvJemI3hHUolQN4zLrmBR PPSs/yfJ2KUnmg/1oCk59nSbpRZe+EQV1KxC8HZHiGPAgSKebvKV1XKKF+JwrPGEiKqlzI NfjNKjAp6ssQ4paD1taIspqB+zq28wXJk/IOz01J8BBIdH1ILKKeEnoTgQqYq1NL5BiyCW c/RlYvXxzCuEz9Oz4M6HYl7RKntDzQtCE0rGfoS86EryLckjQvjXGKxGR5k/yg== In-Reply-To: <0D2879BC-E8B4-40DA-9D6B-990D408D2409@gmail.com> X-Migadu-Flow: FLOW_OUT Received-SPF: pass client-ip=2001:41d0:2:267::; envelope-from=theo@thornhill.no; helo=out0.migadu.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:300288 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable >> On Nov 16, 2022, at 12:58 PM, Yuan Fu wrote: >>=20 >>>>=20 >>>> :language mode >>>> :override t >>>> :feature 'statement >>>> '((expression_statement (identifier) @font-lock-variable-name-face) >>>> (labeled_statement >>>> label: (statement_identifier) @font-lock-type-face)) >>>>=20 >>>=20 >>> stuff like: >>> ``` >>> add_edge: // <- this thing >>> gx +=3D WINDOW_LEFT_EDGE_X (w); >>> gy +=3D WINDOW_TOP_EDGE_Y (w); >>>=20 >>> store_rect: // <- and this thing >>> STORE_NATIVE_RECT (*rect, gx, gy, width, height); >>>=20 >>> ``` >>=20 >> What=E2=80=99s the intention of this query? >>=20 >> (expression_statement (identifier) @font-lock-variable-name-face) >>=20 >> It seems to match statements like >>=20 >> var; >>=20 >> ? >>=20 >> Yuan > > You probably missed this message, ping :-) > Yeah, sorry! I think it can be removed. I really don't remember why I made that... I added the fix in a patch, and also fixed a typo (I think that messed up some fontlocking in c-ts-mode) as an apology :-) Theo --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Fix-some-font-lock-settings.patch >From 4a81b73bc97b01ea9619e517809997397213f0dc Mon Sep 17 00:00:00 2001 From: Theodor Thornhill Date: Mon, 21 Nov 2022 12:14:07 +0100 Subject: [PATCH] Fix some font-lock-settings * lisp/progmodes/c-ts-mode.el (c-ts-mode--font-lock-settings): Remove expression_statement and fix typo for the c-ts-mode--fontify-declarator font lock helper function. --- lisp/progmodes/c-ts-mode.el | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el index 6ba209c0fb..17f27611a5 100644 --- a/lisp/progmodes/c-ts-mode.el +++ b/lisp/progmodes/c-ts-mode.el @@ -263,19 +263,19 @@ c-ts-mode--font-lock-settings declarator: (_) @font-lock-variable-name-face) (field_declaration - declarator: (_) @c-ts-mode--fontify-struct-declarator) + declarator: (_) @c-ts-mode--fontify-declarator) (function_definition - declarator: (_) @c-ts-mode--fontify-struct-declarator)) + declarator: (_) @c-ts-mode--fontify-declarator)) ;; Should we highlight identifiers in the parameter list? ;; (parameter_declaration - ;; declarator: (_) @c-ts-mode--fontify-struct-declarator)) + ;; declarator: (_) @c-ts-mode--fontify-declarator)) :language mode :feature 'assignment ;; TODO: Recursively highlight identifiers in parenthesized - ;; expressions, see `c-ts-mode--fontify-struct-declarator' for + ;; expressions, see `c-ts-mode--fontify-declarator' for ;; inspiration. '((assignment_expression left: (identifier) @font-lock-variable-name-face) @@ -299,8 +299,7 @@ c-ts-mode--font-lock-settings :language mode :feature 'label - '((expression_statement (identifier) @font-lock-variable-name-face) - (labeled_statement + '((labeled_statement label: (statement_identifier) @font-lock-constant-face)) :language mode -- 2.34.1 --=-=-=--