From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id 6GjICWBu5mOsQAAAbAwnHQ (envelope-from ) for ; Fri, 10 Feb 2023 17:18:40 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id eDd5CWBu5mP9rAAAauVa8A (envelope-from ) for ; Fri, 10 Feb 2023 17:18:40 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id A812B165E2 for ; Fri, 10 Feb 2023 17:18:39 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pQW69-0007XR-S8; Fri, 10 Feb 2023 11:18:05 -0500 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 1pQW67-0007XG-Jz for guix-patches@gnu.org; Fri, 10 Feb 2023 11:18:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pQW67-0004eX-6b for guix-patches@gnu.org; Fri, 10 Feb 2023 11:18:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pQW66-0000O1-6q for guix-patches@gnu.org; Fri, 10 Feb 2023 11:18:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#49946] [PATCH 00/31] Tree-sitter, node-gyp addon support and emacs-tree-sitter Resent-From: Pierre Langlois Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 10 Feb 2023 16:18:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49946 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: zimoun Cc: Pierre Langlois , 49946@debbugs.gnu.org Received: via spool by 49946-submit@debbugs.gnu.org id=B49946.16760458751473 (code B ref 49946); Fri, 10 Feb 2023 16:18:02 +0000 Received: (at 49946) by debbugs.gnu.org; 10 Feb 2023 16:17:55 +0000 Received: from localhost ([127.0.0.1]:37943 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pQW5z-0000Nh-3k for submit@debbugs.gnu.org; Fri, 10 Feb 2023 11:17:55 -0500 Received: from mout.gmx.net ([212.227.17.20]:52213) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pQW5u-0000NR-Cn for 49946@debbugs.gnu.org; Fri, 10 Feb 2023 11:17:53 -0500 Received: from labiere ([82.69.64.142]) by mail.gmx.net (mrgmx105 [212.227.17.174]) with ESMTPSA (Nemesis) id 1MAfYm-1pJsFR3gVM-00B3lH; Fri, 10 Feb 2023 17:17:42 +0100 References: <87mtfi63ut.fsf@gmx.com> <20221125012142.22579-1-pierre.langlois@gmx.com> <20221125012142.22579-7-pierre.langlois@gmx.com> <87r0xrcpei.fsf@gmx.com> <864jrxogxt.fsf_-_@gmail.com> User-agent: mu4e 1.8.13; emacs 28.2 From: Pierre Langlois Date: Fri, 10 Feb 2023 16:14:38 +0000 In-reply-to: <864jrxogxt.fsf_-_@gmail.com> Message-ID: <87k00pqyu4.fsf@gmx.com> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-Provags-ID: V03:K1:s3MaM2fmEw3MTJ3NGOOb7XBYlxzx/q6NAs5DJJH7s5zR1k2dadE w6R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/CIMlNSTKbzrEdalmmt2DlKOmyv5Ok fmIF0ULAVVQfYwnsCgOHSzPrB9/qeFMwA+De+I0RNdFJsLNsK6Q1UjMzxiV8sKV/mQvORTaY3 F3Xc7MNVPKzNkLaWFT4VfImSlDmg7Y6+TAHyMJZoE7YyTyUQWxcNWfDD0L5GFPAnBuW5uw== X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Seal: i=1; s=key1; d=yhetil.org; t=1676045919; a=rsa-sha256; cv=none; b=KiMeIZ3J/cDSpAjSzV0MnGqZxR+VdTZRtc/m+Mf+MdAiP8b/iuz7oBxiEdJ3uWRfvqo5zS gl3/NeKA8zDzaSudtqVhM+x5bBp/YeNgp/XPwt9WlDWslSJ8Huzpolrgu6W1mHd/ICgbI5 g/eR7g/53Bds7q+6LglLyy/dLTGAr6isBT7NZLv75YP6GYAgKKsodfhPEGReFIuwnzipcd MABVg2uuSdtrx8qriV88u5N6bCaCPSuf21g3ftdO4gS+xzl0B4GiTmna9hE72iC8y2bfyV qU4iOoUzaKgj0CYOOiCpDCqlyCInLRDmQjRX4S6MgBuFRV+1QO+kyOoKafE+6Q== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=gmx.com (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1676045919; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:resent-cc:resent-from:resent-sender: resent-message-id:in-reply-to:in-reply-to:references:references: list-id:list-help:list-unsubscribe:list-subscribe:list-post; bh=scldiXQho4eRFl0ccPF3Cf2krAWS1KK54iPjTn7b8eQ=; b=MQix5TfPLgNn7O1zm57lTgT7aBjryX/e+FWS9g+pfCoGGYR2V73FE1T8vvvQ+yhm7e9IdW 97CqdLlKHNivEvpkiK5+VhsnwbqO7N52V+a9a+6I6e6VqmbutXWV1xMj7RG6/5eK7md9qj lOmlkFLaDongCxDJHBY54fMw77IU5CsM/ckzKRAS//dX7jtIVphTsRutIF+e3PkJ5wYXRA xeYAVxOj7J74BtfPG3FFlleyVdsKcFko/lLU4EtYxVXpHxBvLBs0x9+QdrQ3mCK6eH2zU+ Rb1z6SrSZvmEZ2LxqQnYusjeJfU9MunX3wfqY6jRcEUScTdmglxnD3aInTKhjw== X-Migadu-Scanner: scn0.migadu.com X-Spam-Score: -6.01 X-Migadu-Queue-Id: A812B165E2 X-Migadu-Spam-Score: -6.01 Authentication-Results: aspmx1.migadu.com; dkim=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=gmx.com (policy=none) X-TUID: snqP8AWma635 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi! zimoun writes: > Hi, > > Sorry, I have totally overlooked this tree-sitter story. :-) And I have > not read all the patch versions and thread yet. > > > On Fri, 25 Nov 2022 at 01:57, Pierre Langlois w= rote: > >> +(define* (install #:key target grammar-directories outputs #:allow-othe= r-keys) >> + (let ((lib (string-append (assoc-ref outputs "out") >> + "/lib/tree-sitter"))) >> + (mkdir-p lib) >> + (define (compile-language dir) >> + (with-directory-excursion dir >> + (let ((lang (assoc-ref (call-with-input-file "src/grammar.json" >> + read-json) >> + "name")) >> + (source-file (lambda (path) >> + (if (file-exists? path) >> + path >> + #f)))) >> + (apply invoke >> + `(,(if target >> + (string-append target "-g++") >> + "g++") > > Why is g++ required? Is gcc not enough? I thought from Tree-sitter > documentation that it was only using C files and not C++; but=E2=80=A6 > >> + "-shared" >> + "-fPIC" >> + "-fno-exceptions" >> + "-O2" >> + "-g" >> + "-o" ,(string-append lib "/" lang ".so") >> + ;; An additional `scanner.{c,cc}' file is sometimes >> + ;; provided. >> + ,@(cond >> + ((source-file "src/scanner.c") >> + =3D> (lambda (file) (list "-xc" "-std=3Dc99" fil= e))) >> + ((source-file "src/scanner.cc") > > =E2=80=A6apparently not. Yeah this is a little strange. IIUC, the final code generated from the grammar.js->grammar.json->grammar.c process is plain C, but grammar packages may also provide some custom hand-written code in terms of a scanner.{c,cc} file. Thanks, Pierre --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQFMBAEBCgA2FiEEctU9gYy29KFyWDdMqPyeRH9PfVQFAmPmbiMYHHBpZXJyZS5s YW5nbG9pc0BnbXguY29tAAoJEKj8nkR/T31Ufh8H/2wXw3F0BZ1URGv+OtovTkzA lD0M1W0RWrY/Qr0mkq0kRjsnpGVj0gFxAAJ3trN6Cq9lhS1A9eEqjiJdfbBf5RUi eO0p7PhtQb8yxjyV08NRIGcvYw0Hv0d96z1B0SICIqluTHHiyvJUP0qTmehzLEsy DBade3OhY30ApjxIITQdCxjBpIqUf5ZXC5XIWzIfUAncymAMUm9/hIDSgemGU5zL mdTd3Z+XZL7bJ5e/eyQ0m2cWWwDcknZEPdDSac4qCEBqWdTUAJj+hjVKRA93CcZL j0N0cMrLo+3b/CHqMjjMcmUQbS4KDGhwAxsApeQj/52sB9lBEki8GJNfCaDwCbc= =FBLh -----END PGP SIGNATURE----- --=-=-=--