From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Po Lu Newsgroups: gmane.emacs.devel Subject: Re: Implementation direction for shell-script-mode with tree-sitter Date: Wed, 26 Oct 2022 08:52:27 +0800 Message-ID: <87mt9j1k50.fsf@yahoo.com> References: Mime-Version: 1.0 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="7968"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: emacs-devel@gnu.org, Yuan Fu , Theodor Thornhill , Eli Zaretskii To: =?utf-8?Q?Jo=C3=A3o?= Paulo Labegalini de Carvalho Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Oct 26 02:56:30 2022 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 1onUia-0001rQ-RT for ged-emacs-devel@m.gmane-mx.org; Wed, 26 Oct 2022 02:56:28 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1onUey-0001m3-2p; Tue, 25 Oct 2022 20:52:44 -0400 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 1onUew-0001NK-GN for emacs-devel@gnu.org; Tue, 25 Oct 2022 20:52:42 -0400 Original-Received: from sonic308-10.consmr.mail.ne1.yahoo.com ([66.163.187.33]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1onUeu-0004EU-VF for emacs-devel@gnu.org; Tue, 25 Oct 2022 20:52:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1666745556; bh=UZcQkvt177rE1cKIbHtfqveHFo9U12sB+FS7Ro2lEAU=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From:Subject:Reply-To; b=UQ6u09u0xoNS26aQjjcgWeX9M3niTwpsetmt3k1hKNvXc3DiNiCZxUiwkkfG1UyfdOb9MLi6Vxlis06Ye3QIBjLG5/oW8vukwKOXfPDsHtxhRd24Df4QNTOMoC/jcIZ8+xudBIturkO/vE5clh0q2tZE8PgQeXLyXGsiN7jHQr00OBvCV9qTZ0sHqI4ksL7hXe/2a1HPt1S6eHrtyjz6YlD1Hw6p7Xy0HBe8v3osOPiSieg9Yhb/g9J0WhKumBoLayBgXAJMKcdXovONxo5hISw0DJp4v6DW4CNn+m3tHFZIs2aXSaIBJnTVA9qzA9CZWLyCXSgA99WYigJg+tVcaA== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1666745556; bh=ZYwACf4LZOGMixalD25QT1kbgO40ZNYlPkMGCDAXH1G=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=XkLWBi31lR9hYlwJXyg0XTd9PT8E8Yw4cwPUvXgPpTTBU5/HHbtj9+nXTGNp02V1Z1Y5ewclaWz7/RMD3fhdan+amKKS2kUPoR028RvyOCKAAjhULgm0SH6dzmxRaBHPIa9B5gefx1LkwavfEEwH3hhEb0O5vkDhcSgkpqiTT9Tist0AC2Rv7CIcqw09kdUO3y5Mq8EegjhnoUQ4HE9szu7zP0//KCn2t+Hyyf3O84bA9bIldfTzq7E2d8sy5LVevJFu2KQcEMxUeTl7MbF6gI8V/BTLUwFsG4UBnX0SQiEJL/vpqCuFkDT6hvZOVqnCt0FrswYUDPD39I+ssh754g== X-YMail-OSG: YMonL64VM1m7kdZNvP_q3lQuwZaOQaVhgtrt8jNlXHOZEtl13Yp7yw6A8GX_QNL 5.O.BQ7Tywpvg0LxjaACwsDvfV6lmUSQph9vsR30CUuK_hYMQY7FYj7koUOvigG387fISFreiPfU pFh2smBt5bO8bDl4AC4A9yzsZfo93WueYcJcZcT0X7CQkvu6QucStpyxP2DPfNk0GvCZV3q1gGD8 41xEbxpiV8r62V5TuJzBatoA1kHapsy73caPYAqWLANlTGgGNhVBZbAv0FMs6kKPCy7VYLhvkuVE ZB3FgJkIPbWiX0w9Eil8OEEy4_pDafb2ZjH0CrvqcBORfOgZlPcXau8SUSK0cSlMoOMzpswFInRD AUVQm4isPn9lSpprrsGCuTr50ZXMAVZwGRGNr_JkrWfb.PTVv2tFapa9cPL7CcymPoFZXJ7Vehoh 2gXWJC2.xrHRmDMHb3q9dY3oaoFx2RsMWRESJBVW5s9C7KXo.dk9pkb2pJg2xDdU4e8V8HI.6PtK 3xFANjgwSjURPX8pf7FFSyZ6YrSw79VRPQdVrJZYl.v8AAdUXo0fQErJFKIFBMZ0xfKIbCUDbEpK MxfjivVJ4ycJz.k3latzyOP8hzCdgSakd4.Q_rIM2x.CqXb_jJVGwrMshilk48PdNMMJYNUhg01i PGvizx41jV0tRsDWx7lY45X6rDBjcX9FyO25A4Kl7m8lnhzjUIp9Sn50Rs4tqvNXH9kle6jtBkkn IYhpWx3JTs1RZA_YAayYT.Oi0uxg3sVl.qcjTYKfO68.UGBwLPoEL3RoBsEYTzDoC8v9l9A0X4TZ 98G2rxCCa1mWD74Mya2dmJkTHKsb4Fl46xN1gwhs4U X-Sonic-MF: Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic308.consmr.mail.ne1.yahoo.com with HTTP; Wed, 26 Oct 2022 00:52:36 +0000 Original-Received: by hermes--production-sg3-74fb94585-g2qrq (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID af421fce21e1173db48fd1cdbaf0044f; Wed, 26 Oct 2022 00:52:33 +0000 (UTC) In-Reply-To: (=?utf-8?Q?=22Jo=C3=A3o?= Paulo Labegalini de Carvalho"'s message of "Tue, 25 Oct 2022 09:05:10 -0600") X-Mailer: WebService/1.1.20783 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Received-SPF: pass client-ip=66.163.187.33; envelope-from=luangruo@yahoo.com; helo=sonic308-10.consmr.mail.ne1.yahoo.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, RCVD_IN_MSPIKE_H2=-0.001, 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: , Original-Sender: "Emacs-devel" Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:298504 Archived-At: Jo=C3=A3o Paulo Labegalini de Carvalho writes: > Hi, > > The tree-sitter-bash grammar does not include many reserved words and > builtin commands that are currently fontified by the regex based > fontication in shell-script-mode. > > Here a list of the ones that tree-sitter-bash does not recognize: > > ("time" "coproc" "type" "trap" "exit" "exec" "continue" "break" "return" = "logout" "bye") > > According to the Bash Reference Manual, all of the above are reserved wor= ds. > > Should I make a PR to tree-sitter-bash to incorporate the missing > keywords or should I just filter them out of the list that I obtain > through (and other variables in `shell-script-mode'): > > (append (sh-feature sh-leading-keywords) > (sh-feature sh-other-keywords)) > > I am attaching the patch so everyone can see code and understand > better what I did. I welcome all criticism and feedback. > > PS.: I am looking at the tree-sitter-bash and it does not seem very > complicated to extend it to recognize the missing keywords. But I can > definitely keep working independently of that. N.B that shell-script-mode supports shells other than bash, so maybe a tree-sitter-bash based variant should be spun off into its own `bash-mode', as opposed to possibly interfering with the support for all of rest?