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: Validating tree-sitter major modes and grammar Date: Tue, 24 Dec 2024 13:30:43 -0800 Message-ID: <2723DC3D-0F51-445A-912E-4D441976AB2E@gmail.com> References: <2F1CA2E3-4C86-4892-AF6B-0C9CFCE26629@gmail.com> <86pllh2ryo.fsf@gnu.org> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3776.700.51\)) 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="11160"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Emacs Devel , Peter Oliver , =?utf-8?Q?Bj=C3=B6rn_Bidar?= , Stefan Kangas , Perry Smith , =?utf-8?Q?Jostein_Kj=C3=B8nigsen?= , Theodor Thornhill , Vincenzo Pupillo , Randy Taylor , Wilhelm Kirschbaum , john muhl , Dmitry Gutov , Juri Linkov To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Dec 24 22:32:22 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 1tQCVo-0002mc-KP for ged-emacs-devel@m.gmane-mx.org; Tue, 24 Dec 2024 22:32:20 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tQCVA-0000Fe-4M; Tue, 24 Dec 2024 16:31:44 -0500 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 1tQCUe-0008Tc-Qe for emacs-devel@gnu.org; Tue, 24 Dec 2024 16:31:17 -0500 Original-Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tQCUW-000425-3f; Tue, 24 Dec 2024 16:31:08 -0500 Original-Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-21675fd60feso74532705ad.2; Tue, 24 Dec 2024 13:30:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1735075857; x=1735680657; darn=gnu.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=gcfi8jl7sBGpZTPZcuSKIJvnuXnYs5djezK+lKc6hxA=; b=eE7hSdrE3HRhLcNHbXF9eskyzGBLaaZnKjNfKVG2Wdw7awjfqxhE1PixqBqUA1qEqT c4k6I1Lzu4MIBuyFAuoLgnrsGJ/olqG80nTAmK2v1H4zIyFGJKWCFTh3phFHguVzR+/N YCdmWZ5uulEIGHLCLg1KVWnnHOZW4zuWGkS3r6iQSWb/d7SuHtDnFgxDvXp5enbLSFnc Zfuci90rz9cJZHXjebGUf7NEUkS60LqjfOpxC6g/FqNi4TRQ0captBwlmY9rXjiXfZiJ tg74o+elrJbEdNyCLthhdme8wv0EwRYkRt+ABqgT6kAwP8b+bD3eUTq/4SgaXyQpvMpT 8nUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735075857; x=1735680657; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gcfi8jl7sBGpZTPZcuSKIJvnuXnYs5djezK+lKc6hxA=; b=Sa4c53amJ3m780ubmuQukkS6MdrrA1YboJvuXKqj32a/eZFKQFbLGzHxtVY0Xs9CZi vpyVf4hiehvzIWheoLnkqWjD/wNMSB3SBz8qm3e/u5b9R8yElww8O1Qj68fcXZEo0fxm 4j49sWs3aWXe7LxNtm7K1oLW9pRm1Bgy5nHD1F9DVIH6dFHEJRW70dHb41N454lI9J/I jLmIqg5pDKn3aRd9D2hIWzZkxZJRpNFQ3OiorqTxuERe9nNUzr0tUGxc8lGl+8fFmd87 s1EoxJ+mH0CKLpKQsrhsMLhqBK7pZTrClVqZ5CC5Pg98kyjUYTxM2TYlEQ7VBhjXdLMD 1oUQ== X-Gm-Message-State: AOJu0YwWWvWOM5vFO67S98WGMEGBGKS1SHX4iR7r359fkca/owcBlQv+ qM7QRUaSAto8YadEBo582tgHcD+Fv1wkmxR/n7fsJhyMUreKNsoNhEnn7McK X-Gm-Gg: ASbGncupxySCn0pOrpXUCUoUoCsUzqPE2/LhgrrTGpQioP1beBXrnExr9wyj39BO7vS SVy7Y4NzCtoRDce3rPvzE3qfkvlmIPYCc+BjhHeOSAKarOD3fZ4IQaeCFGJf4DYBtvez8OeGp90 FwhXp8ZQbw/ibPBt3F98VR72J7UMHbdmYwcI5VY3YxncGRwVgN6/mCn1Hou5fEb+kF2/q9yw8ff WwOGqi/+86iGIwdp3YVdKUTTH05rllhp2nRCP3WOZ6Uvg0Z2TcBOoVrwwS8g4QojJlOlGbW0Mkf Dntu X-Google-Smtp-Source: AGHT+IGLgOx6Mpc2GkQ70AxFDrgSAnwM7BjrX7gIqDHsK3y6Nya+fqg4kicVFHD/Aiq3K8yFCuoidg== X-Received: by 2002:a05:6a20:d80d:b0:1e0:d848:9e8f with SMTP id adf61e73a8af0-1e5e046decbmr31720506637.13.1735075856932; Tue, 24 Dec 2024 13:30:56 -0800 (PST) Original-Received: from smtpclient.apple ([2601:646:8f81:6120:1d98:6810:9846:b152]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72aad8fb8adsm10413657b3a.143.2024.12.24.13.30.54 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Dec 2024 13:30:56 -0800 (PST) In-Reply-To: <86pllh2ryo.fsf@gnu.org> X-Mailer: Apple Mail (2.3776.700.51) Received-SPF: pass client-ip=2607:f8b0:4864:20::62c; envelope-from=casouri@gmail.com; helo=mail-pl1-x62c.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:327033 Archived-At: > On Dec 24, 2024, at 4:19=E2=80=AFAM, Eli Zaretskii = wrote: >=20 >> From: Yuan Fu >> Date: Mon, 23 Dec 2024 19:12:18 -0800 >> Cc: Peter Oliver , >> Bj=C3=B6rn Bidar , >> Stefan Kangas , >> Perry Smith , Perry Smith = , >> Jostein Kj=C3=B8nigsen , >> Theodor Thornhill , >> Vincenzo Pupillo , Randy Taylor , >> Wilhelm Kirschbaum , john muhl , >> Dmitry Gutov , john muhl , >> Juri Linkov >>=20 >>=20 >>=20 >>> On Dec 20, 2024, at 1:09=E2=80=AFAM, Yuan Fu = wrote: >>>=20 >>> Continuing from the tree-sitter maternity thread, I cooked up some = script to go over each builtin tree-sitter mode, clone the grammars it = uses, and check whether the font-lock queries are compatible with the = latest version of the grammar. If everything works fine, the script adds = some comment in the source file listing the version that was checked. >>>=20 >>> For example, I ran the script for c-ts-mode and c++-ts-mode, and = this is the comment inserted to c-ts-mode.el: >>>=20 >>> ;;; Tree-sitter language versions >>> ;; >>> ;; c-ts-mode is known to work with the following languages and = version: >>> ;; - tree-sitter-c: v0.23.4 >>> ;; >>> ;; c++-ts-mode is known to work with the following languages and = version: >>> ;; - tree-sitter-cpp: v0.23.4-1-gf41b4f6 >>> ;; >>> ;; We try our best to make builtin modes work with latest grammar >>> ;; versions, so a more recent grammar version has a good chance to = work. >>> ;; Send us a bug report if it doesn't. >>>=20 >>> The version is taken from =E2=80=9Cgit describe=E2=80=9D. If the = grammar isn=E2=80=99t versioned, it=E2=80=99ll just be the hash of HEAD. = In order for =E2=80=9Cgit describe=E2=80=9D to work, I had to do full = clones, and some tree-sitter grammar=E2=80=99s repo is very slow to = clone. I wonder if there=E2=80=99s anything we can do to speed it up?=20 >>>=20 >>> Any thoughts/comments? I pushed the code to master so others can = play with it. >>>=20 >>> BTW, the script revealed that cmake-ts-mode isn=E2=80=99t compatible = with the latest grammar. I=E2=80=99ll try fix it later. >>=20 >> (This is now fixed.) >>=20 >>=20 >>=20 >> CC=E2=80=99ing maintainers for builtin modes for comments. Also, Eli, = what=E2=80=99s your thoughts on this after the clarification?=20 >=20 > Sorry, I thought we had this discussion concluded and closed. What > are the issues that still need decisions? About running the script semi-regularly and adding recommended version = comments to builtin modes. Are there any concerns? If most people think it=E2=80=99s a good idea, I=E2=80=99ll run the = script for all the builtin modes, which will add the comments. And I = plan to run it myself from time to time to update the comments. = Maintainers for a particular mode can also run it to update the comment = themselves. And I=E2=80=99ll add more detailed documentation about how = to use the script. Yuan=