From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Tree-sitter api Date: Fri, 10 Sep 2021 09:32:56 +0300 Message-ID: <837dfpj5yf.fsf@gnu.org> References: <83r1f7hydn.fsf@gnu.org> <95F37923-5BF9-4D81-B361-267CF119FBCA@gmail.com> <735AF34C-FD18-4A6A-A99D-E5D8EB4DE4F3@gmail.com> <40611F1F-7B5C-4885-A2CA-CE709ED8D22B@gmail.com> <4E876354-10D1-46B3-8124-CAE916261F08@gmail.com> <0A3F5464-B90D-4D47-BBDD-CCA26D877F43@gmail.com> <83tuiys1y4.fsf@gnu.org> <835yvcpdip.fsf@gnu.org> <7B1F90DE-A992-4F51-B391-0A4E5A598780@gmail.com> <3E8CA8E4-E623-4051-A76D-508C6CF94B6A@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="21575"; mail-complaints-to="usenet@ciao.gmane.io" Cc: ubolonton@gmail.com, theo@thornhill.no, cpitclaudel@gmail.com, emacs-devel@gnu.org, monnier@iro.umontreal.ca, stephen_leake@stephe-leake.org To: Yuan Fu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Sep 10 08:34:14 2021 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 1mOa74-0005Kl-F2 for ged-emacs-devel@m.gmane-mx.org; Fri, 10 Sep 2021 08:34:14 +0200 Original-Received: from localhost ([::1]:37276 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mOa73-0006ei-0Z for ged-emacs-devel@m.gmane-mx.org; Fri, 10 Sep 2021 02:34:13 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50600) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mOa67-0005kF-Pt for emacs-devel@gnu.org; Fri, 10 Sep 2021 02:33:15 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:33972) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mOa65-0000LU-5R; Fri, 10 Sep 2021 02:33:13 -0400 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:2497 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mOa64-0000vw-Nu; Fri, 10 Sep 2021 02:33:13 -0400 In-Reply-To: <3E8CA8E4-E623-4051-A76D-508C6CF94B6A@gmail.com> (message from Yuan Fu on Thu, 9 Sep 2021 19:06:28 -0700) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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" Xref: news.gmane.io gmane.emacs.devel:274495 Archived-At: > From: Yuan Fu > Date: Thu, 9 Sep 2021 19:06:28 -0700 > Cc: Tuấn-Anh Nguyễn , > Theodor Thornhill , > Stephen Leake , > Clément Pit-Claudel , > Stefan Monnier , > emacs-devel@gnu.org > > > TS doesn’t load the module, it expects the user to pass it a pointer to the language definition. How does the user get the language definition is not its business. The user is supposed to combine TS and a language definition to create a workable parser. See: > > > > bool ts_parser_set_language(TSParser *self, const TSLanguage *language); > > > > TS only wants a pointer to a TSLanguage. > > > > All the language modules have regular names, i.e., tree-sitter-.so, so I think we can just calculate the name from the language name; or we can add a backup: use an alist to map language names to module names to cover possible irregular names. > > If you think it’s fine, Eli, I’ll start working on this. Sure. I guess we will have to have a database of module names for each programming language somewhere?