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: Re: Call for volunteers: add tree-sitter support to major modes Date: Sun, 23 Oct 2022 21:20:24 -0700 Message-ID: <41981BCB-4797-46C9-B31E-58BA17085207@gmail.com> References: <83sfjtd2bg.fsf@gnu.org> <83o7uhawb9.fsf@gnu.org> <83edv0uzp0.fsf@gnu.org> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.1\)) 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="7286"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , emacs-devel@gnu.org 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 Mon Oct 24 07:30:34 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 1omq2j-0001i5-2T for ged-emacs-devel@m.gmane-mx.org; Mon, 24 Oct 2022 07:30:33 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1omox5-0008VE-RR; Mon, 24 Oct 2022 00:20:41 -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 1omowx-0008OG-UG for emacs-devel@gnu.org; Mon, 24 Oct 2022 00:20:33 -0400 Original-Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1omoww-0006dS-4j; Mon, 24 Oct 2022 00:20:31 -0400 Original-Received: by mail-pj1-x102a.google.com with SMTP id h14so7228789pjv.4; Sun, 23 Oct 2022 21:20:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=8IisyCgX8LMFa3vhyluYQ6a51o6dGHc9xNUh4N5KlNM=; b=dgar/O9EsXBqs0zJcgnEAwWg8VfnO0wFBpK1rOlp7XgDsvnyy8nq9/6LgtzlX0aRoo x3IgNBZ7tHImAUOyHiYYOM26nbZAEHSNcMuDAuUnubPRsJfBVHAZc0Dji9U1kOCauVIA lDyU62g+coMMj4+Jr0dt2KcjHfZlUjfdE95kQe6E1or58RK3ga4PltblKz1e1dz7jtmy q71fPDTb41GPs2By0IiicWJO9ALYfgDNdkr/Bla7VfToNRan34XFRqpotuzJddW7iSDI t3yQaql30YXfaB9x5p9rkXs7D5KnyhKc/34SK8NbebjMtvdr62j4F7OoPjPSQnwoeFyw 90dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8IisyCgX8LMFa3vhyluYQ6a51o6dGHc9xNUh4N5KlNM=; b=OWd0doRJE9UbIBDlc9JnskAIrBlRrER005A/43NgX52W24mG7fWmDWHU/dlteNxRMV ZoizeQnPxtMh859wP0Xwj/M+6KkYHSTVpw+lkN0yqxmEQet4b0qzzi/951zMgoMIva/9 wMhYHfuOwl99gEvu6lnMa6GUJJnm9dqBpgRkfq2zqJCUj8NDg+GaaR5xdFFPZmPqcZR8 Jjb4hQ8930hJfoVMRIC5iYeLxPe/cFIq1bZu3F8mHuSYSFkGP87NRST8dgaltnbaAcqX dE2zl1Ak/7wYIVWkOlX8YwqONGCIR2+4Z4rbum0ox3/Qdcw7TRaDiquUM6YHzAZqZo9o TOrw== X-Gm-Message-State: ACrzQf2Bgx4z7NoLljdt6FS8pch5Eba2GKPdKdJcrxgRfPNpJFiRR7Pq pMQRDQKTvv0e9n+7AYsJb6I= X-Google-Smtp-Source: AMsMyM7/CFm28Ro/9ZAH5dcOWVpx7h/BN6FgIStIYD+ngce78yjo2XPt3ykdlc2YOmktCU587xhcEg== X-Received: by 2002:a17:90b:4b8e:b0:20a:f240:9b23 with SMTP id lr14-20020a17090b4b8e00b0020af2409b23mr36389427pjb.19.1666585225990; Sun, 23 Oct 2022 21:20:25 -0700 (PDT) Original-Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id m20-20020a62a214000000b005609d3d3008sm19776872pff.171.2022.10.23.21.20.25 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 23 Oct 2022 21:20:25 -0700 (PDT) In-Reply-To: X-Mailer: Apple Mail (2.3696.120.41.1.1) Received-SPF: pass client-ip=2607:f8b0:4864:20::102a; envelope-from=casouri@gmail.com; helo=mail-pj1-x102a.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: , 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:298327 Archived-At: > On Oct 22, 2022, at 8:51 AM, Jo=C3=A3o Paulo Labegalini de Carvalho = wrote: >=20 > I am getting a query error but I don't understand why. >=20 > The following query is fine: >=20 > (defvar sh-script--treesit-bash-keywords > '("case" "do" "done" "elif" "else" "esac" "export" "fi" "for" > "function" "if" "in" "unset" "while" "then")) >=20 > (treesit-validate-query 'bash `([ ,@sh-script--treesit-bash-keywords ] = @font-lock-keyword-face)) >=20 > 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 >=20 > time" is highlighted in the *tree-sitter check query* buffer.=20 >=20 > 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) >=20 > `([ ,@(sh-feature sh-leading-keywords) ] @font-lock-keyword-face) > evaluates to: > (["time" "!" "do" "done" ...] @font-lock-keyword-face) >=20 >=20 > Any clues to what I am doing wrong? It is saying that there is no =E2=80=9Ctime=E2=80=9D node in bash = grammar. You probably need to consult the grammar file of = tree-sitter-bash to see what are the keywords it recognizes. For example, running the following snippet=20 (let (collection) (goto-char (point-min)) (while (re-search-forward "'[^ ][^ ]+?'" nil t) (push (match-string 0) collection)) (pop-to-buffer "*result*") (dolist (keyword (cl-remove-duplicates collection :test #'equal)) (insert keyword "\n"))) in the grammar.js gives me '\\\\' '>(' '<(' '$(' ':-' ':?' '${' ')*' '([^' '[^' '--' '++' 'alternative' 'consequence' 'right' '>=3D' '<=3D' '-=3D' '!=3D' 'operator' 'left' '<<<' 'destination' '>|' '>&' '<&' '&>>' '&>' '>>' 'descriptor' 'index' '=3D=3D' '=3D~' 'argument' 'unsetenv' 'unset' 'local' 'readonly' 'export' 'typeset' 'declare' ']]' '[[' '||' '&&' '|&' 'name' 'function' ';;&' ';&' 'fallthrough' ';;' 'termination' 'esac' 'case' 'else' 'elif' 'fi' 'then' 'if' 'done' 'do' 'until' 'while' '))' 'update' 'condition' 'initializer' '((' 'value' 'in' 'variable' 'select' 'for' 'redirect' 'body' '\n' '<<-' '<<' '+=3D' 'bash' '\\s' '\\' '\\]' '\\[' Yuan=