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: Mon, 24 Oct 2022 09:44:43 -0600 Message-ID: References: <83sfjtd2bg.fsf@gnu.org> <83o7uhawb9.fsf@gnu.org> <83edv0uzp0.fsf@gnu.org> <878rl5d9k6.fsf@thornhill.no> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="00000000000041d57505ebc9ac8f" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1340"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , emacs-devel@gnu.org To: Theodor Thornhill Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Oct 24 17:48:01 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 1omzgH-000Adq-6V for ged-emacs-devel@m.gmane-mx.org; Mon, 24 Oct 2022 17:48:01 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1omzdL-0000IR-E9; Mon, 24 Oct 2022 11:44:59 -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 1omzdK-0000I4-2D for emacs-devel@gnu.org; Mon, 24 Oct 2022 11:44:58 -0400 Original-Received: from mail-oa1-x2b.google.com ([2001:4860:4864:20::2b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1omzdI-0003K9-4h; Mon, 24 Oct 2022 11:44:57 -0400 Original-Received: by mail-oa1-x2b.google.com with SMTP id 586e51a60fabf-13ba86b5ac0so3685392fac.1; Mon, 24 Oct 2022 08:44:55 -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=ryZmn/biQSofyRnLGePQUA00DRa5OUiUwn9jtydge7U=; b=kX/RZ6n33wNUk2VfdcElb+yPsUOdfPOMLVlSdgK/3U7W0jyRBrMu1Ajl/UZj1bwhgx bPTc89wXIW+Wzrc99cmqSVRgsey8qPSg9OT+/3uAtnZTJVIod5CvZOb9gzrQ6X5OTPcu qElfYqzxopcapIK84fXFU4AO7D1ZK7p3qrBobkMB2+BfslUwId4tUcyI5u+rCey3XRt1 Crt8gOJTha6uFMPoJnUj5VSV/KUDohFapjvoItVDORYXgRM7sb/CJvKNSmBv4TvlmZT8 41H8m4I1JdfnM8wIkhzQAQBL3ixQ5J5KH1CsTJLX8/RUl1SUOrp/qkWDNcndzcCXyrBH 0MWg== 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=ryZmn/biQSofyRnLGePQUA00DRa5OUiUwn9jtydge7U=; b=HNFkom18WYe3wZA/GkS14c43hs18RGLGIIM9+mz2RGHpc29d/PYR4CVB22ziW7rNAG QkexDTv2PVtc92WrdTKhCEPGDvhx8rpmeXAlChIe6N77Rgqp+L0DF+H536mtAlMO8dAM Ee0tptGQCAvw9n8yzrWrQH89uN9ogzq5npmOD+WR8ToTG5Q7W6wiJjOegTb/13ykgdjx NdBEldOhtSmhCm1sp+kFEt+xpH9hcNwQOrvLVke+aa5xlrmk8h4BARZLETwBxV30c+K2 MK+WgeIMWKdLxdRVVQxBs61pM9WfOd0/5oi86HruvUEbG8p3oUCGnhuDog8O4U0rMPEp HCqA== X-Gm-Message-State: ACrzQf3ijL51rq5ReVZGFGgOZqeT+fApodp9788CJptvqlsg3dkKSWCF 3pr7bAAyOQs03MgkdpQXBKSJ+N0elS7mIF/e0uAFk3va X-Google-Smtp-Source: AMsMyM4ncdj0qGfpAjTCJQUUFlGSSQ3YBycKnTh18y/3y2Y/EaEXneGyVPdNl1cLlIu62WsLyEgsSdMbQaUHZgMZIgM= X-Received: by 2002:a05:6870:ac0d:b0:13b:b9e7:e6d0 with SMTP id kw13-20020a056870ac0d00b0013bb9e7e6d0mr2496335oab.17.1666626294501; Mon, 24 Oct 2022 08:44:54 -0700 (PDT) In-Reply-To: <878rl5d9k6.fsf@thornhill.no> Received-SPF: pass client-ip=2001:4860:4864:20::2b; envelope-from=jaopaulolc@gmail.com; helo=mail-oa1-x2b.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: , 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:298373 Archived-At: --00000000000041d57505ebc9ac8f Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sorry, Theodor. I should have added the code I am actually trying to make it work. I just come from a different culture where a minimal example is preferred over a complete/longer code to show a bug/unexpected behavior. I will make sure to add the code next time. But I believe Yuan spotted the issue. Now I need to figure out a way to proceed. (Please check my response to Yuan). On Mon, Oct 24, 2022 at 12:23 AM Theodor Thornhill wrote: > Jo=C3=A3o Paulo Labegalini de Carvalho writes: > > > 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? > > Can you post the whole mode in its current state? Then I can help you > debug it. I've seen errors like this myself, but most of the time it > has been some sort of error, like a typo in one of the strings. > > I feel there's too little to know exactly what is wrong from your mail, > so the whole source would be nice! > > Thanks, > Theo > --=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 --00000000000041d57505ebc9ac8f Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Sorry, Theodor. I should have added the code I am actually= trying to make it work.

I just come from a different culture where = a minimal example is preferred=C2=A0over a complete/longer code to show a b= ug/unexpected behavior. I will make sure to add the code next time.

= But I believe Yuan spotted the issue. Now I need to figure out a way to pro= ceed. (Please check my response=C2=A0to Yuan).

On Mon, Oct 24, 2022 at 1= 2:23 AM Theodor Thornhill <theo@tho= rnhill.no> wrote:
Jo=C3=A3o Paulo Labegalini de Carvalho <jaopaulolc@gmail.com> writes:
> 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 =C2=A0'("case" "do" "done" &qu= ot;elif" "else" "esac" "export" "fi= " "for"
>=C2=A0 =C2=A0 =C2=A0"function" "if" "in" = "unset" "while" "then"))
>
> (treesit-validate-query 'bash `([ ,@sh-script--treesit-bash-keywor= ds ]
> @font-lock-keyword-face))
>
> However the following query is said INVALID by `treesit-validate-query= ':
> (treesit-validate-query 'bash `([ ,@(sh-feature sh-leading-keyword= s) ]
> @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?

Can you post the whole mode in its current state?=C2=A0 Then I can help you=
debug it.=C2=A0 I've seen errors like this myself, but most of the time= it
has been some sort of error, like a typo in one of the strings.

I feel there's too little to know exactly what is wrong from your mail,=
so the whole source would be nice!

Thanks,
Theo


--
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
--00000000000041d57505ebc9ac8f--