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 17:16:13 -0800 Message-ID: <54DB9B75-AF89-47CE-B077-A1EB2F7857AA@gmail.com> References: <2F1CA2E3-4C86-4892-AF6B-0C9CFCE26629@gmail.com> <868qs6vd76.fsf@aarsen.me> 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="12302"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Emacs Devel , Peter Oliver , =?utf-8?Q?Bj=C3=B6rn_Bidar?= , Stefan Kangas To: =?utf-8?Q?Arsen_Arsenovi=C4=87?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Dec 24 02:17:25 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 1tPtY5-0002y5-Gn for ged-emacs-devel@m.gmane-mx.org; Tue, 24 Dec 2024 02:17:25 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tPtXT-0006xR-Dy; Mon, 23 Dec 2024 20:16:48 -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 1tPtXA-0006vb-OK for emacs-devel@gnu.org; Mon, 23 Dec 2024 20:16:29 -0500 Original-Received: from mail-pj1-x1036.google.com ([2607:f8b0:4864:20::1036]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tPtX9-0000mG-5D for emacs-devel@gnu.org; Mon, 23 Dec 2024 20:16:28 -0500 Original-Received: by mail-pj1-x1036.google.com with SMTP id 98e67ed59e1d1-2ee76befe58so4470457a91.2 for ; Mon, 23 Dec 2024 17:16:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1735002985; x=1735607785; 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=YiFB+91tFJkOp8u1cPxYNo82rHfOFA6l0onFdg6Ld4g=; b=YXQOf3Qnmy00h/x2LoNChdubzzFxRPIiy2l+sues7KOtGGCB3Y6rvSRp4aXVA9T4ej xdqP58rQpfCjCyrgAcZsv/s26RGCJj2WgBq502G1GANGm9bdNGdceaLY1sHZfG9qcvN/ vVp367c0vvYm3xVj+jRXNR12qyZJooCOWrqgyY5okoVJq/4jsoQReHwJu/bah96m8eZQ +hgrEdlAZEtR6JIO5vcwLpWtVYSo3pENB42AdqzHWoDHIgKYoFtjDuKJ7AVOJ/se7aep 4k13Fw8hQLfJj9IvaNAgR1bhSP5Lsmkju1c52jOWx+b6li+Nsqck+Z5wK23rRwHcvdPU iGsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735002985; x=1735607785; 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=YiFB+91tFJkOp8u1cPxYNo82rHfOFA6l0onFdg6Ld4g=; b=IcKAIW5PaMgy+pjcX7Es1yxUhw0vGSOZydqqSJPS0arI4VIJ7BP7OxcpwMdCbwZ8sg bmgw+BI11zFvTodkjyQvtHoOOWpNnl0/J39DK7E97HLTNhyBlTXU21q5PPUYKoX39YnK uyWEmNcN06hbCV+eL807r2EuaEnsexlweO4kP4Lr/QgvB3auPhsnXu1ysE0QB7acRNFd NP9z8le7kDudY67SBhk0fNhmEGmiQ2GP0yZaKtjXtbr2L+1L0jF1z0vvlDRTwu0dxk2j oir5Y7+2T7r3GUEYmzn++TwRA5001/tNm5OTaG+02ObZyKVuSVp1qa7sEHiI5XGtDgg/ ASRw== X-Gm-Message-State: AOJu0Yw5e+/iHIptYG/Y8MxvxAmgn0VwNCIVPCto2gz1KRINStY6nSbs 6Qp1ersSu0/tT7B4s0Bwqph6Q+5B74eVk1VMNX3neVpLP/1Xhebu/1ZuZQ== X-Gm-Gg: ASbGncs2XF8SX0kTLweZ2TISskFkbWYkCL8GuzOZUIiBka/DbfBATQFVTpqAf42z/L1 uE3iA10HddUWPF4mD5uPOtF/7BC6gUy5zcx9t+kfJ/W0yK0f2hP2oO5RIa1FYtknxplnEppePb6 BdXJJ35lgDQUNqk0Q1GusOoEKj8VXnAIWQgXaUeGEO9WALRo/nDm6GqPFPN19Juk6s5xZX7JwU/ oeO98WI4XWJYy4HKNfY46IDsNmxLHMnDJIVir7Lww0LypwljgU9hFm2EAI/vid1LVrunwpRaNDP HrtT X-Google-Smtp-Source: AGHT+IEcsOUpcKGRkt62Rj9H6KjPenCU1u2DJGSyxCysOtGSpp0znQ3aA++msrRqBYJU7ImrH0XQLQ== X-Received: by 2002:a17:90a:e18f:b0:2ee:c291:765a with SMTP id 98e67ed59e1d1-2f452debd4fmr25778292a91.8.1735002985514; Mon, 23 Dec 2024 17:16:25 -0800 (PST) Original-Received: from smtpclient.apple ([2601:646:8f81:6120:1d98:6810:9846:b152]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f2ed52cf35sm11112114a91.11.2024.12.23.17.16.24 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Dec 2024 17:16:24 -0800 (PST) In-Reply-To: <868qs6vd76.fsf@aarsen.me> X-Mailer: Apple Mail (2.3776.700.51) Received-SPF: pass client-ip=2607:f8b0:4864:20::1036; envelope-from=casouri@gmail.com; helo=mail-pj1-x1036.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:326941 Archived-At: > On Dec 23, 2024, at 3:41=E2=80=AFAM, Arsen Arsenovi=C4=87 = wrote: >=20 > Hi Yuan, >=20 > Yuan Fu writes: >=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.20.8-61-g3efee11 >> ;; >> ;; c++-ts-mode is known to work with the following languages and = version: >> ;; - tree-sitter-cpp: v0.20.5-49-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 > Maybe this: >=20 > ~$ time git clone --filter=3Dblob:none = https://github.com/tree-sitter/tree-sitter-c/ > [...] >=20 > real 0m1.380s > user 0m0.104s > sys 0m0.069s > ~$ cd tree-sitter-c > ~/tree-sitter-c$ git describe HEAD > v0.20.8-61-g3efee11 >=20 > A normal clone was 7.2 seconds, for reference. Note that all future > checkouts will be slowed down (as they will need to fetch fresh = blobs), > but if you're only cloning for HEAD anyway, that's fine. > --=20 > Arsen Arsenovi=C4=87 Thanks! This is exactly what I need. Yuan=