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: Mon, 23 Dec 2024 19:12:18 -0800 Message-ID: References: <2F1CA2E3-4C86-4892-AF6B-0C9CFCE26629@gmail.com> 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="3923"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Peter Oliver , =?utf-8?Q?Bj=C3=B6rn_Bidar?= , Stefan Kangas , Perry Smith , Perry Smith , =?utf-8?Q?Jostein_Kj=C3=B8nigsen?= , Theodor Thornhill , Vincenzo Pupillo , Randy Taylor , Wilhelm Kirschbaum , john muhl , Dmitry Gutov , john muhl , Juri Linkov To: Emacs Devel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Dec 24 04:13:27 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 1tPvMN-0000vH-58 for ged-emacs-devel@m.gmane-mx.org; Tue, 24 Dec 2024 04:13:27 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tPvLX-0002OX-SG; Mon, 23 Dec 2024 22:12:35 -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 1tPvLW-0002OC-50 for emacs-devel@gnu.org; Mon, 23 Dec 2024 22:12:34 -0500 Original-Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tPvLU-0004QC-Mk for emacs-devel@gnu.org; Mon, 23 Dec 2024 22:12:33 -0500 Original-Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-216401de828so44210505ad.3 for ; Mon, 23 Dec 2024 19:12:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1735009950; x=1735614750; 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=r3RTlbAMDpLgYGT964cNZcC9PoMPnFTxN3o50J9i7Oo=; b=JDl5X1ZCC6VxovFdsqt/gCDZlU9gLNg5/4IcK3ZOgcMmJ1ma7gGOPUekvJ4J4gUKFQ 2shRv4FXEo3CN4OD30vAS51IlqyHE7GM4JdiDODc2RaCuG2knF3G4kaSTeJgvK9sU0/e hUQLbHdQouNwypyxY4CUx8/X59BQgy1VeSI6m41jShDnZMC2dshDyh7g3I0pMOWcz7SJ YVnaUDDJ+RNgOQ9ICCfLf7ExCg4TgqJviZGTTa7EjWgK3ryykxqqx5DxxEaO1MMX5nyw n5Hg8lfY7dD7na4i0z+LJfQQ9JFV7WUopDM7hmpzDYcHWsXAXf6/awb82+C9RbGJ7fRH N1HQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735009950; x=1735614750; 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=r3RTlbAMDpLgYGT964cNZcC9PoMPnFTxN3o50J9i7Oo=; b=rw4EzHJgsBex/yhZmt2ujItSnQUqLIdhSjCQR/QSMccZsB1oy/VNPOXXn3HRqlm1Wn IF9a1rZKyDVP+7U+NbkkBytt1oHImHfKDGX2oJzbsVRRcVhthIEYYV47zkDE0UWAg8gO eXNKjSr7zUqrmczFUlkQdoAr5PFeYOVywRfcdGjrYhi7mMPcMKAeBd4FZT4hjmK8g1GX ufGlQo3ucMO/BYXrFl18hM7c076HyWxii/UDupdURDwqZL4Bo+/nyV02+tjHC3SpaGBz k/u/PdTMMZGkHtRpLeLhVCrIcQnnqgWeW8YRpUQJfnQDtGmjhtFYUxF74xJO3fKrw5j9 ocIg== X-Gm-Message-State: AOJu0Ywu9B7wFltm5Q7Vq/iPhF3KQK35FSQdB/Nbs/rfddWvL4LnNHnK pUMpiG9RXHQt01I/MUar4jrjfgfGV7N+dFG/NlOa7/+h7S1vSyPYUxz/UZTF X-Gm-Gg: ASbGnct1079bSDGsiINAmGUm6T7ED4FI5TVtzduhIGCdhHeEs31CftiKY8j/llgKtVU WgJ/k8glmohCQUny1u08TtoIlyy/FnHunVw4YHWHYvlhHN2qWsV3ajcRT8zU44cvLXXKOZcawkn iONMWzxfv1d0rKX6uFJtdbQ02X6x5qXsntOoBYGk6MRIyqvIWqh7RVAsV7VsW7BHDa7kJjgPHLj /L8UcyvrxWWZF3U9zPDlNCa+hLIBC6lrnE4aSFIWiKDUZ3yTthLhqMNgF1fe4ytfdJmpQyqusSt CW3H X-Google-Smtp-Source: AGHT+IGfXMp6NW3MPOGcp7RDWmtQWi54T2IEKK7LmPj/8inFA42ycHOBl5FZE8hjDm0I0f+BCMcaHA== X-Received: by 2002:a05:6a00:4ac5:b0:725:f18a:da52 with SMTP id d2e1a72fcca58-72abdd3c1d4mr23285548b3a.4.1735009950531; Mon, 23 Dec 2024 19:12:30 -0800 (PST) Original-Received: from smtpclient.apple ([2601:646:8f81:6120:1d98:6810:9846:b152]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72aad8dbafesm8894859b3a.128.2024.12.23.19.12.28 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Dec 2024 19:12:29 -0800 (PST) In-Reply-To: <2F1CA2E3-4C86-4892-AF6B-0C9CFCE26629@gmail.com> X-Mailer: Apple Mail (2.3776.700.51) Received-SPF: pass client-ip=2607:f8b0:4864:20::630; envelope-from=casouri@gmail.com; helo=mail-pl1-x630.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:326944 Archived-At: > 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. (This is now fixed.) CC=E2=80=99ing maintainers for builtin modes for comments. Also, Eli, = what=E2=80=99s your thoughts on this after the clarification?=20 Yuan=