all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Pranshu Sharma <pranshusharma198@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Yuan Fu <casouri@gmail.com>, 72691@debbugs.gnu.org
Subject: bug#72691: Recursive descent in treesiter parse tree
Date: Mon, 19 Aug 2024 00:57:54 +1000	[thread overview]
Message-ID: <CACKBRFkio0rFbswJMBAyTvOfrCqbdrhtQ9h3-Dzna3d10TyPhA@mail.gmail.com> (raw)
In-Reply-To: <86y14uyyid.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 1085 bytes --]

Ok, I found the solution: you have to capture  witha function and traverse
the whole tree recursively

On Sun, 18 Aug 2024, 7:24 pm Eli Zaretskii, <eliz@gnu.org> wrote:

> > From: Pranshu Sharma <pranshusharma198@gmail.com>
> > 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.
>

[-- Attachment #2: Type: text/html, Size: 1551 bytes --]

  reply	other threads:[~2024-08-18 14:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-18  4:57 bug#72691: Recursive descent in treesiter parse tree Pranshu Sharma
2024-08-18  9:24 ` Eli Zaretskii
2024-08-18 14:57   ` Pranshu Sharma [this message]
2024-08-20  3:38     ` Yuan Fu
2024-08-31  8:12       ` 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=CACKBRFkio0rFbswJMBAyTvOfrCqbdrhtQ9h3-Dzna3d10TyPhA@mail.gmail.com \
    --to=pranshusharma198@gmail.com \
    --cc=72691@debbugs.gnu.org \
    --cc=casouri@gmail.com \
    --cc=eliz@gnu.org \
    /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.