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.bugs Subject: bug#59633: 29.0.50; tree-sitter-bash: Incorrect behaviour of heredocs with expansions Date: Thu, 1 Dec 2022 21:25:26 -0800 Message-ID: <90FF5B60-A9AB-4101-9FE3-8FCAD8B9DCE8@gmail.com> References: <871qpocq7s.fsf@miha-pc> 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="18889"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 59633@debbugs.gnu.org To: miha@kamnitnik.top Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Dec 02 06:26:26 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1p0yZ7-0004hc-TU for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 02 Dec 2022 06:26:25 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p0yYq-0007dl-PS; Fri, 02 Dec 2022 00:26:08 -0500 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 1p0yYl-0007d7-6I for bug-gnu-emacs@gnu.org; Fri, 02 Dec 2022 00:26:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p0yYk-0008Bv-Nl for bug-gnu-emacs@gnu.org; Fri, 02 Dec 2022 00:26:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p0yYk-0007fU-DK for bug-gnu-emacs@gnu.org; Fri, 02 Dec 2022 00:26:02 -0500 X-Loop: help-debbugs@gnu.org In-Reply-To: <871qpocq7s.fsf@miha-pc> Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 02 Dec 2022 05:26:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 59633 X-GNU-PR-Package: emacs Original-Received: via spool by 59633-submit@debbugs.gnu.org id=B59633.166995873729469 (code B ref 59633); Fri, 02 Dec 2022 05:26:02 +0000 Original-Received: (at 59633) by debbugs.gnu.org; 2 Dec 2022 05:25:37 +0000 Original-Received: from localhost ([127.0.0.1]:44206 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p0yYL-0007fF-1L for submit@debbugs.gnu.org; Fri, 02 Dec 2022 00:25:37 -0500 Original-Received: from mail-pj1-f51.google.com ([209.85.216.51]:41734) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p0yYI-0007f9-Lt for 59633@debbugs.gnu.org; Fri, 02 Dec 2022 00:25:35 -0500 Original-Received: by mail-pj1-f51.google.com with SMTP id w15-20020a17090a380f00b0021873113cb4so4209476pjb.0 for <59633@debbugs.gnu.org>; Thu, 01 Dec 2022 21:25:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:cc:date:message-id:subject:mime-version :content-transfer-encoding:from:from:to:cc:subject:date:message-id :reply-to; bh=pFYzJTVB/v/ZcTG3Q7MMsEA+WCfBPwDc2x004f//bkY=; b=PLjItMs43kI6Oxacb/K6O9WwpX2TCXaN1oB3thWw3J94MyLNDZ0hs4DRIM+jj+e2n/ OAe4rZIGis1oJTPTPsY7mW3OCOoth5Xk81/546QL8tF4H2i1vAsVRsyngbRdt07H+ktW mPbe7KYH6G4PN3PDv9tpZRIYGCeqfXUp71oZlGvNpqLixscl64IJ7Pi8/N8Df4CjCD1F yNOFxnRgdhFlGXKUJo/pnqqW6tNYzXAU+mXMmbt60YVomtZWX6YoKIDvXujtod8Hu5fx ABEYpSX0Zb40hbjz+mTKZKFEqprgbLDMN4feeJcqUqJFyixWG9+AHjP2TP8bZpe0AGGT WgnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:cc:date:message-id:subject:mime-version :content-transfer-encoding:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pFYzJTVB/v/ZcTG3Q7MMsEA+WCfBPwDc2x004f//bkY=; b=NeqOf0kmzVY4+IO/miT/O6/KEKZY8evy/z892VjsFynbh3TjhwZjRVTK+lUygJbCXu 2BgCE2VmwV84hK6qY+NuY+KTOMPgOf0KX/wnronytjblKXGxvxnYhQrRBWK2andX4Owh oYG1oR4BfL2Tx5RvB9OytHN88rfoAeMHHrf3gJxD5VxJgSXJhtTS3rIRKYKBk3ejjhle tDLU4PXEWGm5kLt+v2FXBTf+gzMmEOgUVLJdRuaOcinkP7PJ+cZ+mXlqy5hIFZ+FxdIe aEjQaE6Xs+zABaXwNMqkeZ6x+N7hVNHBZ6mOTik2pe/NoWgUtIUBI05w6aeIuUoyDqKT l4rg== X-Gm-Message-State: ANoB5pk1lpJDFiiT++ihJXAnbcz6oZBbsfQ2GX0Jn6py9cJKpG40GG1a URpIeC9+cVyo4kCWJ7CXQAQA9SsTsslL0g== X-Google-Smtp-Source: AA0mqf6AOiFtC5XVQ6NDJeZK9KXYV2Is8yYvH9p/CqeAEIBFazupvLnjE/fJa2diFZd1F24Q6J9Pbw== X-Received: by 2002:a17:902:6b07:b0:189:93a5:bcc6 with SMTP id o7-20020a1709026b0700b0018993a5bcc6mr21182459plk.156.1669958728651; Thu, 01 Dec 2022 21:25:28 -0800 (PST) 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 cp15-20020a170902e78f00b0018981daee22sm4579713plb.17.2022.12.01.21.25.27 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Dec 2022 21:25:28 -0800 (PST) X-Mailer: Apple Mail (2.3696.120.41.1.1) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:249702 Archived-At: miha@kamnitnik.top writes: > 1. Visit empty buffer test in fundamental mode (C-x b test RET) > 2. Insert > > tee << EOF > text1 $var > text2 $(echo cmd) > text3 > $var2 > EOF > > 3. Put point before "text2" > 4. M-x load-library RET treesit RET > 5. M-: (treesit-node-children (treesit-node-at (point) 'bash)) > > =3D> (# > #) > > Note that this list is incorrect, "$var2" at the end of heredoc is > missing. > > 6. M-: (treesit-node-first-child-for-pos (treesit-node-at (point) = 'bash) (point)) > > =3D> nil > > Expected return value here is # > > I'm not sure if this bug is on Emacs, tree-sitter-bash or even > tree-sitter itself and I don't know how to check. > > tree-sitter-bash version: 0.19.0.r19.g77cf8a7-1 > tree-sitter version: 0.20.7-1 > > Thanks and best regards. Thanks. This is the tree produced by tree-sitter, does it match your expectation? (heredoc_body (simple_expansion $ (variable_name)) (command_substitution $( (command name: (command_name (word)) argument: (word)) )) (simple_expansion $ (variable_name))) treesit-node-at gives you the _smallest_ node at point, maybe that=E2=80=99= s why you didn=E2=80=99t see expected behavior? Yuan