From: "Gerd Möllmann" <gerd.moellmann@gmail.com>
To: Yuan Fu <casouri@gmail.com>
Cc: Emacs Devel <emacs-devel@gnu.org>, Eli Zaretskii <eliz@gnu.org>,
Helmut Eller <eller.helmut@gmail.com>
Subject: Re: MPS: treesit
Date: Wed, 26 Jun 2024 06:54:15 +0200 [thread overview]
Message-ID: <m234p0mhhk.fsf@pro2.fritz.box> (raw)
In-Reply-To: <B1650561-578E-4D60-8CBA-828DEF0E8BDA@gmail.com> (Yuan Fu's message of "Tue, 25 Jun 2024 21:35:11 -0700")
Yuan Fu <casouri@gmail.com> writes:
>> On Jun 25, 2024, at 12:44 AM, Gerd Möllmann <gerd.moellmann@gmail.com> wrote:
>>
>> Gerd Möllmann <gerd.moellmann@gmail.com> writes:
>>
>>> Can somone help and explain how this works in treesit.c? Where is the
>>> Lisp_TS_Parser stored and how/where is the TSParser * that gets passed
>>> to the treesiter dylib translated to the Lisp_TS_Parser *?
>>
>> Forget that question, I see it, TSInput and so on. But I'd be interested
>> if there are other such constructs in treesit?
>>
>
> If you mean tree-sitter struct that’s exposed to lisp, there are
> Lisp_TS_Parser, Lisp_TS_Node, and Lisp_TS_Query. Lisp_TS_Node is a
> node in the parser tree, Lisp_TS_Query is a lazily compiled query.
> Tree-sitter queries, like regexp, are compiled from string to
> tree-sitter’s internal struct before being used. HTH.
Hi Yuan!
In the TSInput case that I could fix, TSInput::payload, a void *, is set
to point to a Lisp_TS_Parser, and the read callback in treesit.c gets
access to that parser because tree-sitter passes it the payload pointer.
What happened with igc is that the Lisp_TS_Parser object was moved in
memory, which is normal because MPS is a copying collector, but the
TSInput::payload pointer wasn't changed accordingly because I didn't
know that a reference was hiding there.
My question is if there is a second case like that. A pointer to a
Lisp_TS_xy or a Lisp_Object for such an object that is hiding in a place
that isn't apparent. At least for someoneo like me :-).
next prev parent reply other threads:[~2024-06-26 4:54 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-25 5:27 MPS: treesit Gerd Möllmann
2024-06-25 7:44 ` Gerd Möllmann
2024-06-25 8:28 ` Gerd Möllmann
2024-06-25 15:23 ` Eli Zaretskii
2024-06-26 4:35 ` Yuan Fu
2024-06-26 4:35 ` Yuan Fu
2024-06-26 4:54 ` Gerd Möllmann [this message]
2024-06-26 5:18 ` Yuan Fu
2024-06-26 5:25 ` Gerd Möllmann
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=m234p0mhhk.fsf@pro2.fritz.box \
--to=gerd.moellmann@gmail.com \
--cc=casouri@gmail.com \
--cc=eliz@gnu.org \
--cc=eller.helmut@gmail.com \
--cc=emacs-devel@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.