From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Jo=C3=A3o_Paulo_Labegalini_de_Carvalho?= Newsgroups: gmane.emacs.devel Subject: Re: Implementation direction for shell-script-mode with tree-sitter Date: Tue, 25 Oct 2022 10:26:32 -0600 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000009f2e8d05ebde5fe0" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1050"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org, Yuan Fu , Theodor Thornhill , Eli Zaretskii To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Oct 25 18:27:54 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 1onMmP-000AXa-Rx for ged-emacs-devel@m.gmane-mx.org; Tue, 25 Oct 2022 18:27:53 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1onMld-00087I-M5; Tue, 25 Oct 2022 12:27:07 -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 1onMlb-0007cb-Tc for emacs-devel@gnu.org; Tue, 25 Oct 2022 12:27:03 -0400 Original-Received: from mail-ot1-x32d.google.com ([2607:f8b0:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1onMlN-0007TH-BZ; Tue, 25 Oct 2022 12:27:03 -0400 Original-Received: by mail-ot1-x32d.google.com with SMTP id d18-20020a05683025d200b00661c6f1b6a4so8058725otu.1; Tue, 25 Oct 2022 09:26:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=eJ9YE+QcAk9Y8oj0Nol8nB/ZgqdZrkvxWKbw4cVS8B0=; b=MhSfxmI/6ezh8SVvvbbu3joIR9lhUvwKxyuTO5tMgfubToQ96I98UGg6EYrifXFW8+ JVuCXy8OlUiwlHkdSN+U2ANgw8NGMhHbtKjnce+IPW4hdVzZHGtrbwtxxBbjJt3WatpD 2u2YmxpFWw8j8VN8vMnFZmdZ82roIKQDoq7K5nosSys3OfE4lEtdBbnq5AEggx6db9CO FYv6TKKlKgPc+No9+D4e6NO4gx1WwE9BnTpemSKmEcvoXoL57TcP5EfXGyQX1gXNtviT HU5nqrSJlqUXQuhTB1rOFFBrSF2DzplzvmSZbZHu6Cw6qiIQT/hb/ytI18mglBySahiS ykfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=eJ9YE+QcAk9Y8oj0Nol8nB/ZgqdZrkvxWKbw4cVS8B0=; b=z53h2cqUYhKYmYWVWUI2jH+qVTIJxBFvMxRfBTVoy3yXaAuyaVGnG0r52JZOUC52ds iDSKmCDuqOdjcQMrEvMI52Y3Ibie62y0WnaNp5tiPXCqn9rSGo81YP6mfLI0q9ODgg5u 6u8oKDcaZjOGcb4TyJnQC/4sF0qZ+vY5M8L8B4nbAbfZ0cLujbtOOR11GZ2KBcQ0CSaY IdTvfVK0CG66ZjJ/OQjV7+xmbz2/zxNNy0I3SQ3S/Pg/r+A1zVrczcwTpzYCoK98sPVJ zPILLUtQoKrBZXAuHa17kexlMRLmFPV/1g/O9JSXG1dF1dhIdAiyLc3DhH2bPOIElQbb 2VFQ== X-Gm-Message-State: ACrzQf1sZxGFlw984j89K62iVgB02JSucgW/wkjQPYjmNzlNU6d/j1gp IcM2VIBA+1oRo+Z5sOoWgHjEceblBqBMLU1QVP4= X-Google-Smtp-Source: AMsMyM7C33CMXCDos4JImxAntMcgFsDZkU3RePIfw5IAhJurZIWiWSdG5iM1FqB5nGwOF9bpzNF4hgVzZtL4IUYvF+4= X-Received: by 2002:a05:6830:1098:b0:667:97cc:7a30 with SMTP id y24-20020a056830109800b0066797cc7a30mr974434oto.102.1666715203086; Tue, 25 Oct 2022 09:26:43 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2607:f8b0:4864:20::32d; envelope-from=jaopaulolc@gmail.com; helo=mail-ot1-x32d.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, HTML_MESSAGE=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:298479 Archived-At: --0000000000009f2e8d05ebde5fe0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable > AFAIK `time` is clearly a bug in the tree-sitter grammar. > E.g. it probably causes a misparse for things like: > > time while ... do ... done > That was my impression as well. The same probably holds for `coproc`. > I suspect that for the other ones it doesn't make much difference, OTOH. > So maybe the other ones were deliberately omitted to keep > the grammar simpler. > So maybe I should just use a more generic query and use a regex to fontify the keywords. Something like this: (command_name ((word) @font-lock-keyword-face (:match @font-lock-keyword-face))) --=20 Jo=C3=A3o Paulo L. de Carvalho Ph.D Computer Science | IC-UNICAMP | Campinas , SP - Brazil Postdoctoral Research Fellow | University of Alberta | Edmonton, AB - Canad= a joao.carvalho@ic.unicamp.br joao.carvalho@ualberta.ca --0000000000009f2e8d05ebde5fe0 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
AFAIK `time` is clearly a bug in = the tree-sitter grammar.
E.g. it probably causes a misparse for things like:

=C2=A0 =C2=A0 time while ... do ... done

That was my impression as well.

The same probably holds for `coproc`.
I suspect that for the other ones it doesn't make much difference, OTOH= .
So maybe the other ones were deliberately omitted to keep
the grammar simpler.

So maybe I should just use a more generic= query and use a regex to fontify the keywords. Something like this:
(command_name ((word)=C2=A0@font-lock-keyword-fac= e
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0(:match <rx string regex here>=C2=A0@font-lock-keyword-face)))

--
Jo=C3=A3o Paulo L. d= e Carvalho
Ph.D Computer Science | =C2=A0IC-UNICAMP | Campinas , SP - Br= azil
Postdoctoral Research Fellow | University of Alberta | Edmonton, AB= - Canada
--0000000000009f2e8d05ebde5fe0--