From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?Q?Gerd_M=C3=B6llmann?= Newsgroups: gmane.emacs.devel Subject: Re: MPS: treesit Date: Wed, 26 Jun 2024 06:54:15 +0200 Message-ID: References: Mime-Version: 1.0 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="35839"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Emacs Devel , Eli Zaretskii , Helmut Eller To: Yuan Fu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Jun 26 06:55:23 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 1sMKgl-0009C8-02 for ged-emacs-devel@m.gmane-mx.org; Wed, 26 Jun 2024 06:55:23 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMKfn-0000iJ-MK; Wed, 26 Jun 2024 00:54:23 -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 1sMKfl-0000hy-MT for emacs-devel@gnu.org; Wed, 26 Jun 2024 00:54:21 -0400 Original-Received: from mail-ej1-x630.google.com ([2a00:1450:4864:20::630]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMKfj-0008V7-8s; Wed, 26 Jun 2024 00:54:20 -0400 Original-Received: by mail-ej1-x630.google.com with SMTP id a640c23a62f3a-a72420e84feso497834466b.0; Tue, 25 Jun 2024 21:54:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719377657; x=1719982457; darn=gnu.org; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=3ysG6bxk5O8DAmt6wiEOv372B1qx4E8h1roAPGdIscw=; b=Zrm82JqoJPHnMzlYAqr3ON8rYSmkJP81C3wDx294C2OASlO6hoEBzIQ3SSxMIze7cM lYX79Kv4Upnq+LPuXmgxqh5sW0gCpEgU/1IdjXpe/ByGV6SOVudWEt+LBb0fNWqPwQ6t 16XWwawtTqHXLdqFKVk9pYjpbjWvBFzgPs0oTX/r58p3SS05K0AH+cys2RshbatsXkde vIJbrrWbsbQ7XAHXr5nFdVU6SfpV+CsP3ccOP5aFrMjtUufWyUUuUggg8VdjBR74D0GD qYWm86FE5fXkzEFm/FzvtrptkG3R96Gxg2j+NAlJp5eiLd+uPkj+IKMOq569rbelJMz+ GtoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719377657; x=1719982457; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=3ysG6bxk5O8DAmt6wiEOv372B1qx4E8h1roAPGdIscw=; b=JjEWfTSktJjZWC2n310JFlPD3fFhjwzlrO0Jnyv91dcsaolGv39CGVgEjinxtKGxy6 unzX23ie3xOuqqD9VxT0obuYYIsYIO/AGA4rt54DDeElFriwKGJzVBgb15U3+dN7mLNR SS+Mj4m9eOPopv/4fkiF+UpQYjkqm94mrt33XNxzbDl7vv7CcYhykBqmZEEJOJJYzAcx ZQY1vqKrHri2QEs6tJln853gG0eGtxdt2z4H78yCYYEg0LLTVaWoo4DFAviG9/rx1msT E3xToiX8aUtu8PMi/be9T9KaguS9fL6VEzz0EHRMS9+ZP9fC/xNg/+AfspldtQlEo0Pj X1Jg== X-Forwarded-Encrypted: i=1; AJvYcCVCApPPXbXIMV1Qo6SoRVqwI0YcnpdMi2eAVL7beKHOUiBPdcPqv38aM5kuIUs6FyS2S5ioP/BwnGjLdx4= X-Gm-Message-State: AOJu0YzkXro9tGZ/8ueGeotIB8m4DcAXja/dS5cfHf4TOatAvtcXUjPE eoqBnnevzuSBUX4iw8R//21BAUTRpyWLVrCRWa0oj4FA1Ih32AKJVHAfsg== X-Google-Smtp-Source: AGHT+IE96vHxqgLlVhbZWDN0uEb/QK9mjruyfOhMTvNOmZqr7DIY/LO1P7eVdb7+hLudcXSxiUj81w== X-Received: by 2002:a17:907:cbc7:b0:a72:44d8:3051 with SMTP id a640c23a62f3a-a727f6678a5mr188727566b.16.1719377657008; Tue, 25 Jun 2024 21:54:17 -0700 (PDT) Original-Received: from pro2.fritz.box (pd9e360b7.dip0.t-ipconnect.de. [217.227.96.183]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a7260bfb85csm198131166b.40.2024.06.25.21.54.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Jun 2024 21:54:16 -0700 (PDT) In-Reply-To: (Yuan Fu's message of "Tue, 25 Jun 2024 21:35:11 -0700") Received-SPF: pass client-ip=2a00:1450:4864:20::630; envelope-from=gerd.moellmann@gmail.com; helo=mail-ej1-x630.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:320652 Archived-At: Yuan Fu writes: >> 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 > > 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. 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 :-).