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: Call for volunteers: add tree-sitter support to major modes Date: Sat, 22 Oct 2022 09:51:58 -0600 Message-ID: References: <83sfjtd2bg.fsf@gnu.org> <83o7uhawb9.fsf@gnu.org> <83edv0uzp0.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000008c232e05eba18a1c" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38989"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Oct 24 03:40:20 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 1ommRw-0009zJ-OJ for ged-emacs-devel@m.gmane-mx.org; Mon, 24 Oct 2022 03:40:20 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1omiBm-0007N4-J2 for ged-emacs-devel@m.gmane-mx.org; Sun, 23 Oct 2022 17:07:22 -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 1omGnG-0002jr-8p for emacs-devel@gnu.org; Sat, 22 Oct 2022 11:52:14 -0400 Original-Received: from mail-oa1-x29.google.com ([2001:4860:4864:20::29]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1omGnE-00032m-HP; Sat, 22 Oct 2022 11:52:14 -0400 Original-Received: by mail-oa1-x29.google.com with SMTP id 586e51a60fabf-1364357a691so7143288fac.7; Sat, 22 Oct 2022 08:52:11 -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=ABUfnc1qQkIxvQVj22nipj0HvpIp4+u90Lmzte32MkM=; b=pQgpVAaTjfXjhgjBrlCjGr5gjxw36PvRFrjoSepCa+dnCNOACtfa99gRICX0cxNz4/ cqeCXCvY8VflfKVXcB1DFFtpVsDo/ZeaOVooC4THoU5uXb5yCtbLcrZNu7SR1BsmnI+i pmiqh0L9wjo6fTlTq/DwjtjW77eCgSLd9sYE4dMqNKxIBOnl5ipj/4zS1aJDNMUrwess m/Uv96W7bB/o24w+HNlbT9JmAELwp1kdVhbzuIseRwNl97vZD7MuAjmIFwDfCl8t8Rvb +hU/Bbrnesl5ZE/7FPXCZxKoUomLxdIrojSXUQjV1VIjfFamvlrioEGw7e+1q6EfPpzk oCJg== 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=ABUfnc1qQkIxvQVj22nipj0HvpIp4+u90Lmzte32MkM=; b=XLYUIGEgwf29+utBOanQFPza5Ly0TNVxkG2RahRyPb3OXlMi73pByVlURpKblyL2BR wV+QPxSqi87UOqTXezzMpqtjT0KnO2LJesDOAYBKUbfPdIYOPu2z0xdT6D9rAemiFSww lkJhJklxRe3xMib581SoNf/HTBWJMz0CUz5MLxcRObReDf8qD2O2kL3D9yD/NZFhxEqs IudDFGokXiyFogovIplet8nMluzLOui/CvpVyoBcxfhs6cydqBcVDYT7NRl1tI01Kf83 Tg+L7EJDuyfLbD/BKmLles/cmV7iIssUxHZEIkAim/UemssfshtsmsEXdRzWLYTl9Ui+ Dy9A== X-Gm-Message-State: ACrzQf3MMUaHw9oWfsPZBRNQK9+LwQta3Bp9jcmgV2IYZZhcQH8Z09op HBBYUqYSWoJZhbdp7VsIjQO6lLRz6moTgfkEWVPY7eIunFE= X-Google-Smtp-Source: AMsMyM7ZNEwX+qqAolbOih6H5DwL3UGR3VrCMIRj5voztKXIfmTVjWnaVHQb2hOVNpJG2rpFDJGbUlEGxTeuI83dMFE= X-Received: by 2002:a05:6870:d1d0:b0:12c:cfd2:8285 with SMTP id b16-20020a056870d1d000b0012ccfd28285mr16300041oac.105.1666453930253; Sat, 22 Oct 2022 08:52:10 -0700 (PDT) In-Reply-To: <83edv0uzp0.fsf@gnu.org> Received-SPF: pass client-ip=2001:4860:4864:20::29; envelope-from=jaopaulolc@gmail.com; helo=mail-oa1-x29.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, 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" Xref: news.gmane.io gmane.emacs.devel:298284 Archived-At: --0000000000008c232e05eba18a1c Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable I am getting a query error but I don't understand why. The following query is fine: (defvar sh-script--treesit-bash-keywords '("case" "do" "done" "elif" "else" "esac" "export" "fi" "for" "function" "if" "in" "unset" "while" "then")) (treesit-validate-query 'bash `([ ,@sh-script--treesit-bash-keywords ] @font-lock-keyword-face)) However the following query is said INVALID by `treesit-validate-query': (treesit-validate-query 'bash `([ ,@(sh-feature sh-leading-keywords) ] @font-lock-keyword-face)) Node type error at: 3 ["*time"* "!" "do" "done" ...] @font-lock-keyword-face *time"* is highlighted in the *tree-sitter check query* buffer. Even though the forms below evaluate to equivalent forms: `([ ,@sh-script--treesit-bash-keywords] @font-lock-keyword-face) *evaluates to:* ([ "case" "do" "done" "elif" ... ] @font-lock-keyword-face) `([ ,@(sh-feature sh-leading-keywords) ] @font-lock-keyword-face) *evaluates to:* (["time" "!" "do" "done" ...] @font-lock-keyword-face) Any clues to what I am doing wrong? On Sat, Oct 22, 2022 at 12:42 AM Eli Zaretskii wrote: > > From: Jo=C3=A3o Paulo Labegalini de Carvalho > > Date: Fri, 21 Oct 2022 17:45:41 -0600 > > Cc: emacs-devel@gnu.org > > > > With the work a did today I was able to answer my own questions. > > > > I managed to use `sh-feature' function to obtain the lists of keywords = & > builtins for fontification. > > > > I am planning to soon submit a patch for review but mainly for the styl= e > of bits I have implemented. > > Thanks for working on this. > --=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 --0000000000008c232e05eba18a1c Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I am getting a query error but I don'= t understand why.

The following query is fine:

(defvar sh-script--treesit-bash-keywords
=C2=A0 '("c= ase" "do" "done" "elif" "else"= "esac" "export" "fi" "for"
=C2= =A0 =C2=A0 "function" "if" "in" "unset&q= uot; "while" "then"))

(treesit-validate-que= ry 'bash `([ ,@sh-script--treesit-bash-keywords ] @font-lock-keyword-fa= ce))

However the following query is said INVALID by `treesit-= validate-query':
(treesit-validate-query &#= 39;bash `([ ,@(sh-feature sh-leading-keywords) ] @font-lock-keyword-face))<= /font>
Node type error at: 3
["time&= quot; "!" "do" "done" ...]=C2=A0= @font-lock-keyword-face

time&= quot; is highlighted in the *tree-sitte= r check query* buffer.=C2=A0

Even though the forms below eval= uate to equivalent forms:
`([ ,@sh-script--tree= sit-bash-keywords] @font-lock-keyword-face)
evaluates to:<= br>([ "case" "do" "done&q= uot; "elif" ... ] @font-lock-keyword-face)

`([ ,@(sh-feature sh-leading-keywords) ] @font-lock-keywor= d-face)
evaluates to:
(["= time" "!" "do" "done" ...]=C2=A0@font-lock-keyword-face)


Any clues to what I am doing wrong?

On Sat, Oct 22, 2022 at 12:42 AM Eli Zaretskii <eliz@gnu.org> wrote:
> From: Jo=C3=A3o Paulo Labegalini de Carvalho &= lt;jaopaulolc@gmail.com>
> Date: Fri, 21 Oct 2022 17:45:41 -0600
> Cc: emacs-devel@gnu.org
>
> With the work a did today I was able to answer my own questions.
>
> I managed to use `sh-feature' function to obtain the lists of keyw= ords & builtins for fontification.
>
> I am planning to soon submit a patch for review but mainly for the sty= le of bits I have implemented.

Thanks for working on this.


--
Jo= =C3=A3o Paulo L. de Carvalho
Ph.D Computer Science | =C2=A0IC-UNICAMP | = Campinas , SP - Brazil
Postdoctoral Research Fellow | University of Albe= rta | Edmonton, AB - Canada
--0000000000008c232e05eba18a1c--