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: Validating tree-sitter major modes and grammar Date: Tue, 24 Dec 2024 14:19:59 +0200 Message-ID: <86pllh2ryo.fsf@gnu.org> References: <2F1CA2E3-4C86-4892-AF6B-0C9CFCE26629@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="18056"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org, p.d.oliver@mavit.org.uk, bjorn.bidar@thaodan.de, stefankangas@gmail.com, pedz@easesoftware.com, pedz@easesoftware.com, jostein@secure.kjonigsen.net, theo@thornhill.no, v.pupillo@gmail.com, dev@rjt.dev, wkirschbaum@gmail.com, jm@pub.pink, dgutov@yandex.ru, jm@pub.pink, juri@linkov.net To: Yuan Fu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Dec 24 13:20:42 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 1tQ3tx-0004ZG-PL for ged-emacs-devel@m.gmane-mx.org; Tue, 24 Dec 2024 13:20:41 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tQ3tQ-0002rw-Id; Tue, 24 Dec 2024 07:20:08 -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 1tQ3tP-0002qg-0Q for emacs-devel@gnu.org; Tue, 24 Dec 2024 07:20:07 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tQ3tL-0005Uy-3L; Tue, 24 Dec 2024 07:20:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=IhRw/3E81tXUYwN9O07js+36hUiR2Xvr/D8U1NtNyLQ=; b=DuItGMKmaUAEgeqcCimt cQsmX7x8pJWMfK5Q58XuF/MqWkejUJdB1swZrWk7F/tFk/QWIlpg27IMa/K8HSn8eZ0sSAJoNOFpw oHOfLJ1aIX5uF96gj2ZBSciu/Qom7ezqRnJxjUhwv9O99PR7sscGiC4MmJCHRCmDHc+5Bz/dth9z3 6ZYCFMCv+JxmbshlITZx9rYwFXU+6QYIDND7LfeYG/y6uVS7/PEYTDFnz43NxdALL9ANR81F1ot+O 83v24aqgyoNe+1M7wbk1wWL7XMZuUyNjSG0BjnVtCebTnxeId6MJBBsa91PykgWYLta3xPr5GbKBt yMneWn8FpKKm9Q==; In-Reply-To: (message from Yuan Fu on Mon, 23 Dec 2024 19:12:18 -0800) 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:326995 Archived-At: > From: Yuan Fu > Date: Mon, 23 Dec 2024 19:12:18 -0800 > Cc: Peter Oliver , > Björn Bidar , > Stefan Kangas , > Perry Smith , Perry Smith , > Jostein Kjønigsen , > Theodor Thornhill , > Vincenzo Pupillo , Randy Taylor , > Wilhelm Kirschbaum , john muhl , > Dmitry Gutov , john muhl , > Juri Linkov > > > > > On Dec 20, 2024, at 1:09 AM, Yuan Fu wrote: > > > > 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. > > > > 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: > > > > ;;; 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. > > > > The version is taken from “git describe”. If the grammar isn’t versioned, it’ll just be the hash of HEAD. In order for “git describe” to work, I had to do full clones, and some tree-sitter grammar’s repo is very slow to clone. I wonder if there’s anything we can do to speed it up? > > > > Any thoughts/comments? I pushed the code to master so others can play with it. > > > > BTW, the script revealed that cmake-ts-mode isn’t compatible with the latest grammar. I’ll try fix it later. > > (This is now fixed.) > > > > CC’ing maintainers for builtin modes for comments. Also, Eli, what’s your thoughts on this after the clarification? Sorry, I thought we had this discussion concluded and closed. What are the issues that still need decisions?