From: Yuan Fu <casouri@gmail.com>
To: "Gerd Möllmann" <gerd.moellmann@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: Tue, 25 Jun 2024 22:18:16 -0700 [thread overview]
Message-ID: <2F470DB2-3C3C-4BC2-8165-1D31DBDFC40B@gmail.com> (raw)
In-Reply-To: <m234p0mhhk.fsf@pro2.fritz.box>
> On Jun 25, 2024, at 9:54 PM, Gerd Möllmann <gerd.moellmann@gmail.com> wrote:
>
> 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 :-).
Ah, I see. I don’t think there’s another one.
Yuan
next prev parent reply other threads:[~2024-06-26 5:18 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
2024-06-26 5:18 ` Yuan Fu [this message]
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2F470DB2-3C3C-4BC2-8165-1D31DBDFC40B@gmail.com \
--to=casouri@gmail.com \
--cc=eliz@gnu.org \
--cc=eller.helmut@gmail.com \
--cc=emacs-devel@gnu.org \
--cc=gerd.moellmann@gmail.com \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).