From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuan Fu Newsgroups: gmane.emacs.devel Subject: Re: MPS: treesit Date: Tue, 25 Jun 2024 22:18:16 -0700 Message-ID: <2F470DB2-3C3C-4BC2-8165-1D31DBDFC40B@gmail.com> References: Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.600.62\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34679"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Emacs Devel , Eli Zaretskii , Helmut Eller To: =?utf-8?Q?Gerd_M=C3=B6llmann?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Jun 26 07:19:02 2024 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 1sML3e-0008uu-6A for ged-emacs-devel@m.gmane-mx.org; Wed, 26 Jun 2024 07:19:02 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sML3F-0000HV-Tk; Wed, 26 Jun 2024 01:18:37 -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 1sML3D-0000H2-3C for emacs-devel@gnu.org; Wed, 26 Jun 2024 01:18:35 -0400 Original-Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sML3B-0007ZJ-HN; Wed, 26 Jun 2024 01:18:34 -0400 Original-Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-1f9b364faddso51727075ad.3; Tue, 25 Jun 2024 22:18:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719379111; x=1719983911; darn=gnu.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=hMdlw/dH4/RpMjJp1b8DbfyuqiQXnrsD1dYxA2d7G0A=; b=isBZXW5pQo1GKVNNn48ZKZ/TXpxzQHYiQqj0J42yrHycur/Idx7RKBzm2CTHZMqY2R bZtwbxgZTxtq57ZsS7CCJkX2Akaj9B/b2ghmZ7YR+hAHz0qCiylzH7V19gwVffCJ9uGq /fHi0VOBF2s0Ugiy51IyPShduhZaDZHWh7yCf9hXYI1aZzmC9q8b1QKZSpNni1OXK5Gz 2HqWYw5QHZyUGhjps2yUhFLjc8EWcKtJHDwHMW5PRdB+dIVX45cJHgieCj30F//L2Fic Jn/LOQHf0WCLoELME8JrQ6OYRUl6DT29Nk9iT433skqPaMQLbqatFTUyADj8piyzEYKa BCeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719379111; x=1719983911; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hMdlw/dH4/RpMjJp1b8DbfyuqiQXnrsD1dYxA2d7G0A=; b=R3Vixth51Q+Sw9K3MUf3gUR0WkvLI5ziLhP6+rpDZ99E823BEyiW17NGYYF9xVssor t4sHnfHNyjCzTYeda9H9lQkf0DG7x6+/mk33zrgzYPWeqMu6H/o9kc7V0paFRyGuTJpc t2DhSS+M/pjuiRwbgpW2vIcZ3hT/5OtcYUOrolS1/wVJ+NNVRnte/5njlx+25fbMy2Jn onAJ24LLH4uz3iTkHdcKpaD2gd04VTmpkjG4cVy3gUHTqaY3f6h0pOjEXNDiWcK+8dLX LW3LOQ8tJN9nyzyUUnSwx9UZDmreP3Gv0Himr2wSi+OZWsOpfm2Gqy5Iz1ynk+sHnsD5 +18A== X-Forwarded-Encrypted: i=1; AJvYcCX5SL2lfOgZnsb6uODCGniBapoNL82BOHHWmRXTiZBZ3N1EB85Bm3OGb7S8PZiDaqK75OENMNKlrAhSgUE= X-Gm-Message-State: AOJu0YwJuxLQSe6qro56XAF1FSrVQNsUTf+ZoOQ/4AChs9yvkSUcashi 4XxCT4NbVRfn0mO3qXoqfcJQs/JR6dCU0qt7dFMDLbjUdvCQalaPs3Y6Kw== X-Google-Smtp-Source: AGHT+IF2EjdV3rV1czNZ8bNlU8JH9CX5B4YcDLypH+HpyD+msaESYAsE/VuQ85vXmTAUGSQj1ZjveA== X-Received: by 2002:a17:902:ecc7:b0:1fa:1599:386b with SMTP id d9443c01a7336-1fa23f1b898mr86730435ad.20.1719379111377; Tue, 25 Jun 2024 22:18:31 -0700 (PDT) Original-Received: from smtpclient.apple ([2601:646:8f81:6120:3c6b:9027:64f0:9805]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f9eb323636sm89989185ad.102.2024.06.25.22.18.30 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 25 Jun 2024 22:18:30 -0700 (PDT) In-Reply-To: X-Mailer: Apple Mail (2.3774.600.62) Received-SPF: pass client-ip=2607:f8b0:4864:20::62f; envelope-from=casouri@gmail.com; helo=mail-pl1-x62f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=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:320658 Archived-At: > On Jun 25, 2024, at 9:54=E2=80=AFPM, Gerd M=C3=B6llmann = wrote: >=20 > Yuan Fu writes: >=20 >>> On Jun 25, 2024, at 12:44=E2=80=AFAM, Gerd M=C3=B6llmann = wrote: >>>=20 >>> Gerd M=C3=B6llmann writes: >>>=20 >>>> 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 *? >>>=20 >>> Forget that question, I see it, TSInput and so on. But I'd be = interested >>> if there are other such constructs in treesit? >>>=20 >>=20 >> If you mean tree-sitter struct that=E2=80=99s 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=E2=80=99s internal struct before being used. HTH. >=20 > Hi Yuan! >=20 > 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. >=20 > 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. >=20 > 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=E2=80=99t think there=E2=80=99s another one. Yuan=