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: Tree-sitter api Date: Sat, 11 Sep 2021 13:29:09 -0700 Message-ID: <3BC29D06-CA75-4706-9AD7-ABA2F65C4DEE@gmail.com> 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> <837dfpj5yf.fsf@gnu.org> <8335qbirsr.fsf@gnu.org> <73E0B1F6-6F9F-40E0-927E-D08481BFF391@gmail.com> <834kaqhqlp.fsf@gnu.org> <8335qahqgk.fsf@gnu.org> Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) 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="2764"; mail-complaints-to="usenet@ciao.gmane.io" Cc: =?utf-8?B?VHXhuqVuLUFuaCBOZ3V54buFbg==?= , Theodor Thornhill , =?utf-8?Q?Cl=C3=A9ment_Pit-Claudel?= , Emacs developers , Stefan Monnier , stephen_leake@stephe-leake.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Sep 11 22:30:23 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 1mP9dm-0000Vk-Qs for ged-emacs-devel@m.gmane-mx.org; Sat, 11 Sep 2021 22:30:22 +0200 Original-Received: from localhost ([::1]:58398 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mP9dl-0002wH-J3 for ged-emacs-devel@m.gmane-mx.org; Sat, 11 Sep 2021 16:30:21 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59482) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mP9cg-0002Em-V0 for emacs-devel@gnu.org; Sat, 11 Sep 2021 16:29:14 -0400 Original-Received: from mail-qt1-x834.google.com ([2607:f8b0:4864:20::834]:35725) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mP9cf-00033E-AZ; Sat, 11 Sep 2021 16:29:14 -0400 Original-Received: by mail-qt1-x834.google.com with SMTP id u4so4830246qta.2; Sat, 11 Sep 2021 13:29:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=hTv4RePgK5T4c1nQ0K/HGkDfpzNsczQ1uUNSvbT1DZQ=; b=fX4HoYUzdiFAfLyfo1Jt4MsBml5QeULQpmOnfWHfoExHb2aaqI6H3J9eGJ/B3KIXgO RrImQ0LNNd2SRTAuZULQ4GikHSDQcDno0K/pMloNrrocNVfMMMmFL/CkOtseBbbeZJnP q7oEj++WxEzY0QCm7VMhcOKyC6dY5kex+sqekVrTeQqBRx7tifYx96rFbfL7ek1pK9pm nI7MzbaeRc4ZCERI4zWSPhLoO1z8hm2aNyoq6ZyfOnLFXd55zPK+PldH0RxSy29czM3r qYw3/3fu4Y+wh1cxXwdgMtNIMNuHsN2WEq4XAmPjoJSAQ3DtWN8CYu0RFJeiMypMlKh/ LnJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=hTv4RePgK5T4c1nQ0K/HGkDfpzNsczQ1uUNSvbT1DZQ=; b=X+VXPrT2GY+xw3rZp9SLmy8+KLIFd51QKJ2ULoeWT83wkufarUDA16T+C8zGyoAzN+ whOhU69+Tz9P5laxdvmz9gXo1ZFTgVq2Dlq26t8bnuWkCZpcZn0Q1Q/wSRduXbEvKNoX G1E2fllifyhG38KKk4sd3k1RkjeGMzCOzxSVcq1PXDVwhK+PAtCseRzpZtlqnVxSZG6q +26S6u+I8HUWtraYzNFWcUlaZJQiFbS6kuOuLuWqPbV6fd+MzKcEmri2XDvzoFDhq7aA bEhPq3KyKCgoI7jUrUJNim2Rcgzu2up21zHrzsgtOIgogwC7apXmMemBT28sQs/QRPkk PpBg== X-Gm-Message-State: AOAM533oYQGobG5YxAfd+0QR6SeQHhvXAh2EUY83QEzglN177sjsJ6NQ o/R5LXI8cM94m2kxyY3vopGcks/gtjdgsQV6 X-Google-Smtp-Source: ABdhPJwKwROh+0nD9l39M2PQysJ0/911z7fUhnA9tGLrExP0nIFMipPPl+9xkVPHo4oW2kajpui/7Q== X-Received: by 2002:ac8:6b45:: with SMTP id x5mr3361834qts.363.1631392151197; Sat, 11 Sep 2021 13:29:11 -0700 (PDT) Original-Received: from smtpclient.apple ([2600:1700:2ec7:8c9f:a158:bbab:fca1:1f4e]) by smtp.gmail.com with ESMTPSA id c28sm1869667qkl.69.2021.09.11.13.29.10 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 11 Sep 2021 13:29:10 -0700 (PDT) In-Reply-To: <8335qahqgk.fsf@gnu.org> X-Mailer: Apple Mail (2.3654.120.0.1.13) Received-SPF: pass client-ip=2607:f8b0:4864:20::834; envelope-from=casouri@gmail.com; helo=mail-qt1-x834.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.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:274569 Archived-At: > On Sep 11, 2021, at 12:14 PM, Eli Zaretskii wrote: >=20 > But the part is still needed to be concocted somehow. E.g., > the conversion from "C#" to "c-sharp" isn't trivial. >=20 The project name of tree-sitter=E2=80=99s C# definition is = =E2=80=9Ctree-sitter-c-sharp=E2=80=9D[1]. So if someone wants to use the = C# language, they probably know what symbol represents it (we will = explain the translation rule in doc-string and the manual). I also want = to point out that we don=E2=80=99t come up with the symbols representing = each language, the _user_ passes 'tree-sitter-parser-create' a symbol = representing a language, and we translate that symbol to dynamic library = name and C symbol name. [1]: https://github.com/tree-sitter/tree-sitter-c-sharp > On Sep 11, 2021, at 12:17 PM, Eli Zaretskii wrote: >=20 >> Date: Sat, 11 Sep 2021 22:14:26 +0300 >> From: Eli Zaretskii >> Cc: ubolonton@gmail.com, theo@thornhill.no, cpitclaudel@gmail.com, >> emacs-devel@gnu.org, monnier@iro.umontreal.ca, = stephen_leake@stephe-leake.org >>=20 >>> BTW, since dynamic libraries has different extensions on different = systems, what I want to do it to try loading the library with .so, then = try .dylib, then try .dll, is that a good idea? >>=20 >> We can do better, see load-suffixes. >=20 > And in C, you can use MODULES_SUFFIX directly. Though we will > probably need some minor changes there, to have the suffix defined > even in a build --without-modules. I=E2=80=99m using tree-sitter-load-suffixes with default value = =E2=80=98(=E2=80=9C.so=E2=80=9D, =E2=80=9C.dylib=E2=80=9D, =E2=80=9C.dll=E2= =80=9D). Should I populate this variable with MODULES_SUFFIX and = MODULES_SECONDARY_SUFFIX, or should I just use the two SUFFIX in C? = I.e., do you see a need for users to customize suffixes? Yuan=