Subject: [PATCH v5 00/10] Update tree-sitter{, -{c{, pp, -sharp}, go, {java, type}script, python}},

From: Hilton Chain <[email-masked]>
Date: Thu, 19 Oct 2023 23:41:10 +0800

V4 -> V5:
  - [email-masked],
    tree-sitter-javascript: Remove binary file from source.

V3 -> V4:
  - [email-masked],
    [email-masked],
    [email-masked],
    [email-masked],
    [email-masked].

V2 -> V3:
  - [email-masked].
  - Re-indent code in a separate commit to produce more readable diffs.

V1 -> V2:
  - Merge tree-sitter-javascript and tree-sitter-typescript updates into one
commit.
  - Merge tree-sitter-c and tree-sitter-cpp updates into one commit.
  Each case updating the former package breaks build of the latter's old
version.

Hilton Chain (10):
  gnu: tree-sitter: Update to 0.20.10.
  gnu: tree-sitter-bash: Update to 0.20.4.
  gnu: tree-sitter-c-sharp: Update to 0.20.0.
  gnu: tree-sitter-javascript: Update to 0.20.0-22.f772967.
  gnu: tree-sitter-typescript: Update to 0.20.3.
  gnu: tree-sitter-python: Update to 0.20.4.
  gnu: tree-sitter-cpp: Update to 0.20.3.
  gnu: tree-sitter-go: Update to 0.20.0.
  gnu: tree-sitter-rust: Update to 0.20.4.
  gnu: tree-sitter: Re-indent.

 gnu/packages/tree-sitter.scm | 110 +++++++++++++++++++----------------
 1 file changed, 59 insertions(+), 51 deletions(-)

base-commit: c065da01ff956d3c2bdfc45a33d910e509a211d9
--
2.41.0

v4...v5
diff --git a/gnu/packages/tree-sitter.scm b/gnu/packages/tree-sitter.scm
index 29b180026c..41257d42f1 100644
--- a/gnu/packages/tree-sitter.scm
+++ b/gnu/packages/tree-sitter.scm
@@ -96,38 +96,36 @@ (define-public python-tree-sitter
     (license license:expat)))

 (define-public tree-sitter
-  ;; Untagged
-  (let ((commit "0e4ff0bb27edf37b76fc7d35aa768b02cf4392ad"))
-    (package
-      (name "tree-sitter")
-      (version "0.20.10")
-      (source (origin
-                (method git-fetch)
-                (uri (git-reference
-                      (url "https://github.com/tree-sitter/tree-sitter")
-                      (commit commit)))
-                (file-name (git-file-name name version))
-                (sha256
-                 (base32
-                  "1bai4gdhf8w5p1i9np2kl2ms0jq6rgq98qpiipipzayb9jjjlxcy"))
-                (modules '((guix build utils)))
-                (snippet #~(begin
-                             ;; Remove bundled ICU parts
-                             (delete-file-recursively "lib/src/unicode")))))
-      (build-system gnu-build-system)
-      (inputs (list icu4c))
-      (arguments
-       (list #:phases
-             #~(modify-phases %standard-phases
-                 (delete 'configure))
-             #:tests? #f ; there are no tests for the runtime library
-             #:make-flags
-             #~(list (string-append "PREFIX=" #$output)
-                     (string-append "CC=" #$(cc-for-target)))))
-      (home-page "https://tree-sitter.github.io/tree-sitter/")
-      (synopsis "Incremental parsing system for programming tools")
-      (description
-       "Tree-sitter is a parser generator tool and an incremental parsing
+  (package
+    (name "tree-sitter")
+    (version "0.20.10")                 ;untagged
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/tree-sitter/tree-sitter")
+                    (commit "0e4ff0bb27edf37b76fc7d35aa768b02cf4392ad")))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "1bai4gdhf8w5p1i9np2kl2ms0jq6rgq98qpiipipzayb9jjjlxcy"))
+              (modules '((guix build utils)))
+              (snippet #~(begin
+                           ;; Remove bundled ICU parts
+                           (delete-file-recursively "lib/src/unicode")))))
+    (build-system gnu-build-system)
+    (inputs (list icu4c))
+    (arguments
+     (list #:phases
+           #~(modify-phases %standard-phases
+               (delete 'configure))
+           #:tests? #f ; there are no tests for the runtime library
+           #:make-flags
+           #~(list (string-append "PREFIX=" #$output)
+                   (string-append "CC=" #$(cc-for-target)))))
+    (home-page "https://tree-sitter.github.io/tree-sitter/")
+    (synopsis "Incremental parsing system for programming tools")
+    (description
+     "Tree-sitter is a parser generator tool and an incremental parsing
 library.  It can build a concrete syntax tree for a source file and
 efficiently update the syntax tree as the source file is edited.

@@ -142,7 +140,7 @@ (define-public tree-sitter
 @end itemize

 This package includes the @code{libtree-sitter} runtime library.")
-      (license license:expat))))
+    (license license:expat)))

 (define-public tree-sitter-cli
   (package
@@ -319,20 +317,35 @@ (define-public tree-sitter-html
    "0.19.0"))

 (define-public tree-sitter-javascript
-  ;; Required by tree-sitter-typescript.
-  (let ((commit "7a29d06274b7cf87d643212a433d970b73969016")
-        (revision "14"))
+  ;; Commit required by tree-sitter-typescript 0.20.3.
+  (let ((commit "f772967f7b7bc7c28f845be2420a38472b16a8ee")
+        (revision "22"))
     (tree-sitter-grammar
      "javascript" "JavaScript(JSX)"
-     "1pk6d9g6a7bzhxmwnvfiycarcgz76wq2rgfqr0xjh7y7swfw5hvw"
+     "0vp7z57scpbcvyxpya06lnpz9f5kjdb66wjlkrp684xwjjgq1wxd"
      (git-version "0.20.0" revision commit)
-     #:commit commit)))
+     #:commit commit
+     #:get-cleanup-snippet
+     (lambda (grammar-directories)
+       #~(begin
+           (use-modules (guix build utils))
+           (delete-file "tree-sitter-javascript.wasm")
+           (delete-file "binding.gyp")
+           (delete-file-recursively "bindings")
+           (for-each
+            (lambda (lang)
+              (with-directory-excursion lang
+                (delete-file "src/grammar.json")
+                (delete-file "src/node-types.json")
+                (delete-file "src/parser.c")
+                (delete-file-recursively "src/tree_sitter")))
+            '#$grammar-directories))))))

 (define-public tree-sitter-typescript
   (tree-sitter-grammar
    "typescript" "TypeScript and TSX"
-   "0934c35as3wgakqw20ilii8lvby5ns36mmqsxjwz8zg5zfsq14vj"
-   "0.20.2"
+   "08k785q3cy8byrb3zrg93mfidnj1pcx1ggm1xhd8rgmfs2v6jns5"
+   "0.20.3"
    #:inputs (list tree-sitter-javascript)
    #:grammar-directories '("typescript" "tsx")))

@@ -377,14 +390,14 @@ (define-public tree-sitter-elixir
   ;; No tags at all, version in the source code is 0.19.0
   (let ((commit "b20eaa75565243c50be5e35e253d8beb58f45d56")
         (revision "0"))
-      (tree-sitter-grammar
-       "elixir" "Elixir"
-       "1i0c0xki3sv24649p0ws7xs2jagbwg7z7baz1960239bj94nl487"
-       (git-version "0.19.0" revision commit)
-       #:article "an"
-       #:repository-url "https://github.com/elixir-lang/tree-sitter-elixir"
-       #:commit commit
-       #:license (list license:asl2.0 license:expat))))
+    (tree-sitter-grammar
+     "elixir" "Elixir"
+     "1i0c0xki3sv24649p0ws7xs2jagbwg7z7baz1960239bj94nl487"
+     (git-version "0.19.0" revision commit)
+     #:article "an"
+     #:repository-url "https://github.com/elixir-lang/tree-sitter-elixir"
+     #:commit commit
+     #:license (list license:asl2.0 license:expat))))

 (define-public tree-sitter-heex
   (tree-sitter-grammar
@@ -396,8 +409,8 @@ (define-public tree-sitter-heex
 (define-public tree-sitter-bash
   (tree-sitter-grammar
    "bash" "Bash"
-   "11gjjaf9hrsw3rd774c3gq27im2j9gxmkn59wcpg4nwni60p0vjh"
-   "0.20.0"))
+   "01sjympivwhr037c0gdx5fqw8fvzchq4fd4m8wlr8mdw50di0ag2"
+   "0.20.4"))

 (define-public tree-sitter-c-sharp
   (tree-sitter-grammar