From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#72691: Recursive descent in treesiter parse tree Date: Sun, 18 Aug 2024 12:24:26 +0300 Message-ID: <86y14uyyid.fsf@gnu.org> References: Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19688"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 72691@debbugs.gnu.org To: Pranshu Sharma , Yuan Fu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Aug 18 11:25:34 2024 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 1sfcAH-0004yp-Km for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 18 Aug 2024 11:25:33 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sfcA8-0008Kw-73; Sun, 18 Aug 2024 05:25:24 -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 1sfcA6-0008Kk-QD for bug-gnu-emacs@gnu.org; Sun, 18 Aug 2024 05:25:22 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sfcA6-0000Sk-HK for bug-gnu-emacs@gnu.org; Sun, 18 Aug 2024 05:25:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=References:In-Reply-To:From:Date:To:Subject; bh=VrmP5Req9mwLaeeKDEdhkfB1ER3WTWPJzx2o5eB5vLQ=; b=G+ZfzZFpKTdbAx7fOprw4WnA8gzE1Th2CCQCX5g7kH4xaYYfN7hm2HtzBSVN0oVXWm5mVem+ZG/l9IVDrkJTZsP7TTNFCg3DRWl2LuA/bCGuaGU93QgriP3gCNgRdFMioUAJPUswaZkmp0M0wJAtgay8ZALJnNqj1wKTZ/ep1KkjGvYz9M7dhN9Vi8m22BgqYPMhy5G79+WZDkWEiVlvEJzZtn3CwdHA4NUKTaGh+zx1fwXZh70Q2d6I19GAP197jmYFLYniHy2zNvth7Q+1T+efdwM/ove4vsrL3S61OeESFPecSKsMNoRaNPHDWERWivxAI7jH4G4Yw8hlKQOCJw==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sfcAk-0008Gr-Ie for bug-gnu-emacs@gnu.org; Sun, 18 Aug 2024 05:26:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 18 Aug 2024 09:26:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72691 X-GNU-PR-Package: emacs Original-Received: via spool by 72691-submit@debbugs.gnu.org id=B72691.172397311631725 (code B ref 72691); Sun, 18 Aug 2024 09:26:02 +0000 Original-Received: (at 72691) by debbugs.gnu.org; 18 Aug 2024 09:25:16 +0000 Original-Received: from localhost ([127.0.0.1]:55430 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sfcA0-0008Fc-D2 for submit@debbugs.gnu.org; Sun, 18 Aug 2024 05:25:16 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:45962) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sfc9y-0008FO-TX for 72691@debbugs.gnu.org; Sun, 18 Aug 2024 05:25:15 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sfc9F-0008P7-Gb; Sun, 18 Aug 2024 05:24:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=VrmP5Req9mwLaeeKDEdhkfB1ER3WTWPJzx2o5eB5vLQ=; b=ZnsZXlvJiQja te1XDWRp8YFvEUPMFwOlbaleVoq0KPQq9tvXYLad/0xCLXCv16BdhkJOuCgQfjzUz86WZNDW+Dob0 on8Pby4IoGfXWfN+AORRQaKhHL98LydFqBeG3yNRpKUWX972wyJBrMb1sJJ+i/o1SJ4mpGQ5pYJTs kN1BtxCLvenPTNVb5qltaUQAKDWbTxSw6av9Q+sm5vDxGshy5WnWppK8lkq578SOZ/nKvuNm+5ZP4 K4GM5pV4IRPS4V/CyIDL4uWvPAfrm95zWfhK6MEb/88dWokgZELxbOG+T6+yE9Q0WwgG3lCazeALR JrPSPOFQfo9i+do23cwckg==; In-Reply-To: (message from Pranshu Sharma on Sun, 18 Aug 2024 14:57:10 +1000) 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:290306 Archived-At: > From: Pranshu Sharma > Date: Sun, 18 Aug 2024 14:57:10 +1000 > > I am trying to write a major mode in which all instances of a node in another matched node. For this, recursion > is needed, and for that it is necessary to store a match in a variable: > Say I want to highlight all instances of (x) that are inside y in the following parse tree, where bolded means I > want to match: > (x) in (q (y (x) (l (x) (l (x) (p))) (x)) > > "(y) @test > @test . (_) @font-lock-variable-name-face" > "(y) @test > (@test . (_) @font-lock-variable-name-face)" > "(y) @test > (test . (_) @font-lock-variable-name-face)" > > All of the above fail, which leads me to think that @test stores the text instead of the tree. In this case, how > would I recursively match all instances of Adding Yuan.