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: Validating tree-sitter major modes and grammar Date: Fri, 20 Dec 2024 01:09:10 -0800 Message-ID: <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="33232"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Peter Oliver , =?utf-8?Q?Bj=C3=B6rn_Bidar?= , Stefan Kangas To: Emacs Devel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Dec 20 10:10:08 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 1tOZ1L-0008Wv-K9 for ged-emacs-devel@m.gmane-mx.org; Fri, 20 Dec 2024 10:10:07 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOZ0i-0002qQ-3c; Fri, 20 Dec 2024 04:09:28 -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 1tOZ0f-0002qE-VI for emacs-devel@gnu.org; Fri, 20 Dec 2024 04:09:25 -0500 Original-Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tOZ0e-0006Ef-J6 for emacs-devel@gnu.org; Fri, 20 Dec 2024 04:09:25 -0500 Original-Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-21680814d42so15334855ad.2 for ; Fri, 20 Dec 2024 01:09:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1734685763; x=1735290563; darn=gnu.org; h=to:cc:date:message-id:subject:mime-version :content-transfer-encoding:from:from:to:cc:subject:date:message-id :reply-to; bh=cT/tYyv5IbjlPGgYKE8ilOE1Yr4Sdy4p61ukUQmVzKU=; b=AjbMjhpmhZbAhog8DuGl2JhwjFiHhopgxzPZXQr4SHLjhtBsW8XDApXohCCs7snhjQ afeR/L5j4F4Sp7FgsFou6/MqHAdhVrWQIQbWnxVRzqnTAXMMnT1jlflGh2USGJ465ZfQ 7jkHvQj4+frAc00q9+X+V30BbCgpC0gem9tjjjuXHTYm4TYOyT8JDs+TTGQyYqmvv+GR YBuARB/Ln6hZf0SBNtsuMLLtFpEA1PLkftuQ9nVP4jEI68EBdHyOSmzRSF+UsIzbhgTK ab/CcMEKV7tGlQu1Y0RSopXjRzAbzDdwen18foGtQ73nAAgLmjq3qLuz89Wr++r+pJUt PiiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734685763; x=1735290563; h=to:cc:date:message-id:subject:mime-version :content-transfer-encoding:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cT/tYyv5IbjlPGgYKE8ilOE1Yr4Sdy4p61ukUQmVzKU=; b=j2Jgwas7JxjPcOxMY1a6NU+k95pB75fjvmuz1txqikjK/xtaw56Qdzy7LZfFEDvtDc ck0CNYAREf/yAMVhM/m1UhUwK4SYv9o6OGh1cbUXCafSWSmZvjRf0DFHvuqdGkviNlKt oSWZLaR06A1S7SpZAMwiOTFY16gch3NpOOmJqa7S+OPsR94bTdJvYDq57TweXZW+4PLX YIBwFI/SSqz4QPItFF2CHTOFIb+pmIG9UXIkN8UN37M0i3uXLU39pE2rtAPf2+D3gr4o 5hdVVPmpTap54STdlTuxWCRLatHQgBTnVNN9g/KUQ0KTt8fSKs34eTCiMFRE8CsL4eLg jgYw== X-Gm-Message-State: AOJu0YwrugYtsSmq40qf2mtGktTTIOtNtwRNKC3XC+3pa+CEXOhLhrAb eiZsKYzpRjpBCTmFW359eTJnNmfkOugBZ3+jc1sMTDTzg/3E9o7JlFd7rA== X-Gm-Gg: ASbGncu6gaXTaseYVMKLjWlb9lEhN38l9WUdw94ldfh7UNQvd92JkafiM7VIH1jBFwi r45UVFD0vsRl95RlgeezS+B6qN07t9rlxfBoeJkJ4U6Mx8xOM4I+38A7GxRXMKYDupYihFzIzbC 06GpsP1QN8F4WLniPaVt63e58Og36LbMDf7Qsk8ilOPOUt0V1NzA9EUHM8ELYdlE0OrHrmQdrkS auF+aH/UkFWw82iaA6pA5P9unLnht8pwQaKmNut9c4js6da9aj2n3CwohI9d7RexacbTqL7I36i Gmdi X-Google-Smtp-Source: AGHT+IGpiOjVyTiC9ej3tLNG2WhjgpPO5mYF2tuYlVSzpZvVXGtwqjEqIEkARQx/IJMNjPy97PaCpg== X-Received: by 2002:a17:902:ce86:b0:216:2dc4:50ab with SMTP id d9443c01a7336-219e6e89b63mr24106635ad.2.1734685762560; Fri, 20 Dec 2024 01:09:22 -0800 (PST) Original-Received: from smtpclient.apple ([2601:646:8f81:6120:256b:fd6a:4865:b807]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-219dc9cdf02sm24641725ad.151.2024.12.20.01.09.21 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 Dec 2024 01:09:21 -0800 (PST) X-Mailer: Apple Mail (2.3776.700.51) Received-SPF: pass client-ip=2607:f8b0:4864:20::634; envelope-from=casouri@gmail.com; helo=mail-pl1-x634.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:326789 Archived-At: 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.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. 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 Any thoughts/comments? I pushed the code to master so others can play = with it. 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. Yuan=