From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Perry Smith Newsgroups: gmane.emacs.devel Subject: Re: More Tree Sitter Questions / Problems. Date: Wed, 14 Dec 2022 17:22:44 -0600 Message-ID: <18305331-97C3-4118-BF7B-8EED588C50F6@easesoftware.com> References: <365D3BA2-298F-4B99-9707-FE8BC658701F@easesoftware.com> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.200.110.1.12\)) Content-Type: multipart/signed; boundary="Apple-Mail=_1856C0FC-50F0-4B79-A01B-7FCF2A0DD024"; protocol="application/pgp-signature"; micalg=pgp-sha256 Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="18185"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Dec 15 00:24:13 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 1p5b6i-0004WY-GG for ged-emacs-devel@m.gmane-mx.org; Thu, 15 Dec 2022 00:24:12 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p5b61-0008Uu-PA; Wed, 14 Dec 2022 18:23:29 -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 1p5b5Z-0008Ro-7d for emacs-devel@gnu.org; Wed, 14 Dec 2022 18:23:22 -0500 Original-Received: from bisque.elm.relay.mailchannels.net ([23.83.212.18]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p5b5X-0002Gi-2C for emacs-devel@gnu.org; Wed, 14 Dec 2022 18:23:00 -0500 X-Sender-Id: a2hosting|x-authuser|pedz+easesoftware.com@mi3-ss4.a2hosting.com Original-Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id E64CA6C0E7B; Wed, 14 Dec 2022 23:22:56 +0000 (UTC) Original-Received: from mi3-ss4.a2hosting.com (unknown [127.0.0.6]) (Authenticated sender: a2hosting) by relay.mailchannels.net (Postfix) with ESMTPA id 32A976C0C35; Wed, 14 Dec 2022 23:22:56 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1671060176; a=rsa-sha256; cv=none; b=u2r+Y7Kxws6u123vwShBYDiGChU8ylsCeqiUVlp0d103SrjrKTYiuW9ek6Lk+9+P0sbRg2 W6EMga368aeiecOuoQX2aIr6feLS5zV/tQe6tYKH6z2rf43lmPRdQocCpCt7iRW2Z5qF14 aabKps7rKvuEoNILL5Y53B4sVUkVYH1NECYyuTwcLHXVwokEwLErDiilUEASFbphuNHrvM jx8sP+qgjSLOX6JEi9yZbPZdq454BgyDDxXJ3Jg2lX4ZL0XlsVBgNgtm8fHBiU1sUoHkvy vAsmv2gjmrhABOWWAleR16Pjnjdr5NuPaib+cMyS8nimVg8YBbGF8qLQTCMAVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1671060176; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references:dkim-signature; bh=WGhhPP9HhrlqSmDRaPM9Z7zuA8RAczdx9YEDXAGXyDc=; b=voLbuKZNF+HTVcfrZnHcYpqgnLwDEypMnaqETJb8CUoi6wsbCCm/gRObAA1ZdffTC5Kw97 0TGi/wWiDn1CvSEinPMAqK0JwBKzqqpC6DsSgAfuFVcML/lcuibOIbTOp8v7EAYHhrmDhV 9WqAeW2lfIe+SvxjwLGK5kpnBGgLNYKLUPKO2bBE+/5LEKmmqft1o3bxZQ322scivqzNgK G2zYglP3ru64kLaPUal9SyJHGEZwJjRyJD7PZvHbY10AmyBCcSGRCYramjDDpw8LnisqTk 8IB2ZJcMv5Hb/1vlG1eteOGXxCEguJTUdX++SSCJlxJIj+MkxcZRvxXwG8r2Qg== ARC-Authentication-Results: i=1; rspamd-d48c5ddb-q5nfm; auth=pass smtp.auth=a2hosting smtp.mailfrom=pedz@easesoftware.com X-Sender-Id: a2hosting|x-authuser|pedz+easesoftware.com@mi3-ss4.a2hosting.com X-MC-Relay: Neutral X-MailChannels-SenderId: a2hosting|x-authuser|pedz+easesoftware.com@mi3-ss4.a2hosting.com X-MailChannels-Auth-Id: a2hosting X-Macabre-Tart: 7477bdf63d64361b_1671060176639_2982470928 X-MC-Loop-Signature: 1671060176639:364822397 X-MC-Ingress-Time: 1671060176639 Original-Received: from mi3-ss4.a2hosting.com (mi3-ss4.a2hosting.com [68.66.200.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384) by 100.126.30.43 (trex/6.7.1); Wed, 14 Dec 2022 23:22:56 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=easesoftware.com; s=default; h=References:To:Cc:In-Reply-To:Date:Subject: Mime-Version:Content-Type:Message-Id:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=WGhhPP9HhrlqSmDRaPM9Z7zuA8RAczdx9YEDXAGXyDc=; b=crOWoSL2ILn39J5z857CCBWCm9 xgBan4di13/97xvHqjWYQJEneyLodplNM9C6ugzft29GsWABzvyGGFxGigWRL1wLML5u7Tx6aw8Ji x/JRZFNY6KWVPGbF1lSTuda9433ABX5FN7qHvYhNgbM1isx4JWkZbZR4zhNsWzmc+UAK8grpD+9ue ZsFvcRPd3FZG/CJHVn2KRZa9GRPL1JY8gDu2btJlzAWL8fal51K27Id+fRTFDhmQbLfuHxRPTjMqK qar5+sz1fdkSy3QsRr8rX6/08k1X7SGGz8rS1qxlHL4ZgcoqCLnQdYO3ABuC7A93YPavH/3BZOknk 6Q9XQjdQ==; Original-Received: from cpe-70-94-128-193.satx.res.rr.com ([70.94.128.193]:54251 helo=smtpclient.apple) by mi3-ss4.a2hosting.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1p5b5T-00Ex7j-5D; Wed, 14 Dec 2022 18:22:55 -0500 In-Reply-To: X-Mailer: Apple Mail (2.3731.200.110.1.12) X-AuthUser: pedz+easesoftware.com@mi3-ss4.a2hosting.com Received-SPF: pass client-ip=23.83.212.18; envelope-from=pedz@easesoftware.com; helo=bisque.elm.relay.mailchannels.net 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, 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: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:301423 Archived-At: --Apple-Mail=_1856C0FC-50F0-4B79-A01B-7FCF2A0DD024 Content-Type: multipart/alternative; boundary="Apple-Mail=_DE540D0E-AF5F-406B-9A35-457E73FB4F4E" --Apple-Mail=_DE540D0E-AF5F-406B-9A35-457E73FB4F4E Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Dec 14, 2022, at 15:15, Stefan Monnier = wrote: >=20 >> foodog =3D 12 + 4 * >> 18 * 99 + 8 >=20 > [ Trying to provide some SMIE perspective: ] >=20 > In the context of sh-mode, I've had requests to provide that kind of > "AST-oblivious" indentation. The result is controlled by > `sh-indent-after-continuation`. >=20 >> variable =3D 12 + 4 * >> 18 * 99 + 8 >=20 > That's my favorite, yes. You might be misunderstanding my concern (but I do appreciate all of = your examples and thoughts). My concern is if Tree Sitter modes deviate too much from the old way, = they may not catch on. Perhaps I should not worry about that. The old = modes are not going anywhere so people can keep which ever they prefer. = But, that is where my worry is coming from. On a slightly different topic but only slightly, I discovered that my = first draft also does this: if 12 * 18 + 45 - 19 frog =3D 12 end Rather than this: if 12 * 18 + 45 - 19 frog =3D 12 end I can change the code but I mention it because I bet others will be = making the same mistake. =E2=80=9Cfrog=E2=80=9D (in the first example) is indented to the bol of = parent. The parent is =E2=80=9Cthen=E2=80=9D (not if) and the = =E2=80=9Cthen=E2=80=9D is on the 2nd line, not the first. So instead of = indenting two spaces from the bol of the =E2=80=9Cif", it is indented = two spaces from the bol of the =E2=80=9Cthen=E2=80=9D which is the 45. All this to say that now that I=E2=80=9Dm getting deeper into this, I = plan to rethink things. =E2=80=9CParent=E2=80=9D, =E2=80=9Cgrand = parent=E2=80=9D, =E2=80=9Cfirst-sibling=E2=80=9D, etc are likely not = going to be good for anchor points because simply adding paren=E2=80=99s = makes a node on level deeper. I think what will be better in the case = of the =E2=80=9Cif=E2=80=9D will be to be anchor to closest =E2=80=9Cif=E2= =80=9D. I=E2=80=99m also coming to the conclusion that =E2=80=9Cparent-bol=E2=80=9D= would be better if it was (bol (parent)) so that (bol (grand-parent)) = and (bol (ancestor =E2=80=9Cif=E2=80=9D)), etc could be easily done. These are mostly =E2=80=9Cthinking out loud=E2=80=9D type comments. I = plan on piddling with things more. Perry --Apple-Mail=_DE540D0E-AF5F-406B-9A35-457E73FB4F4E Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8

On Dec = 14, 2022, at 15:15, Stefan Monnier <monnier@iro.umontreal.ca> = wrote:

foodog =3D 12 + 4 *
   18 * 99 + = 8

[ Trying to provide some SMIE perspective: =  ]

In the context of sh-mode, I've had requests to provide = that kind of
"AST-oblivious" indentation.  The result is = controlled by
`sh-indent-after-continuation`.

variable =3D 12 + 4 *
=             &n= bsp;  18 * 99 + 8

That's my favorite, = yes.

You might be = misunderstanding my concern (but I do appreciate all of your examples = and thoughts).

My concern is if Tree Sitter = modes deviate too much from the old way, they may not catch on. =  Perhaps I should not worry about that.  The old modes are not = going anywhere so people can keep which ever they prefer.  But, = that is where my worry is coming from.

On a = slightly different topic but only slightly, I discovered that my first = draft also does this:

if 12 * 18 = +
   45 - = 19
     frog =3D = 12
end

Rather than = this:

if 12 * 18 = +
   45 - 19
  frog =3D 12
end

I can = change the code but I mention it because I bet others will be making the = same mistake.

=E2=80=9Cfrog=E2=80=9D (in the first = example) is indented to the bol of parent.  The parent is = =E2=80=9Cthen=E2=80=9D (not if) and the =E2=80=9Cthen=E2=80=9D is on the = 2nd line, not the first.  So instead of indenting two spaces from = the bol of the =E2=80=9Cif", it is indented two spaces from the bol of = the =E2=80=9Cthen=E2=80=9D which is the 45.

All = this to say that now that I=E2=80=9Dm getting deeper into this, I plan = to rethink things.  =E2=80=9CParent=E2=80=9D, =E2=80=9Cgrand = parent=E2=80=9D, =E2=80=9Cfirst-sibling=E2=80=9D, etc are likely not = going to be good for anchor points because simply adding paren=E2=80=99s = makes a node on level deeper.  I think what will be better in the = case of the =E2=80=9Cif=E2=80=9D will be to be anchor to closest = =E2=80=9Cif=E2=80=9D.

I=E2=80=99m also coming = to the conclusion that =E2=80=9Cparent-bol=E2=80=9D would be better if = it was (bol (parent)) so that (bol (grand-parent)) and (bol (ancestor = =E2=80=9Cif=E2=80=9D)), etc could be easily = done.

These are mostly =E2=80=9Cthinking out = loud=E2=80=9D type comments.  I plan on piddling with things = more.

Perry


= --Apple-Mail=_DE540D0E-AF5F-406B-9A35-457E73FB4F4E-- --Apple-Mail=_1856C0FC-50F0-4B79-A01B-7FCF2A0DD024 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEE5yOa/gCtQpb3oCpljxzk9yzE+MAFAmOaWsQACgkQjxzk9yzE +MBJChAA02RKRh1s0zS8jvcNDAdRgwNYwA7p7A4ff0d8U41Dah1qIlsu/nlPIfls xsycQFOc8U1pey8k9I5ln+Xo5oUeeHJOL9487rQhC/XAy0/phx1GyOGDS2lGT4Sa fyl8PgHS8DO3L0xX4nEOJQysI05u4hJ6Bw54cwRlVyKzREOtnAmyhMNI2fMmwzqh MtlyT85EVRRktuBDWrvYPSUuZmsgYLY3Fei5Ufc+a0mQ0Z9pZvpiL+LwVyy4PDSR 5filXgfZib0tiCBkW2t61XXSoY2l2BpXB2+FE0xlXc0L4Ee6CCWfDmTLXDl36tpm f6wZZwsDCXc3i4s99TPTIyZjDr6maZdPB+CS33Ziu3Du76qlEW+fflZFaQ3a/Beo 9IMk9X3h4y04XM5UsmfwbG2m1bm2CY09AJ3UQISFw07JGbSCjI6ooEaiHALvhcPc TPExQDlgB53HogPJIsoGIa7i9onssN2iHqjnjSgW6YCoC9VPkWxvto2hxNHFbO5K a/NSaZVSXPFXKs9tjg5MiQW7XwEzNiVjLpNItuPJFRlniduKF/gpbHCN+SfTTlkt 45fYKj77WJadK6IKX55TDt1tpG4qyXIhUmXCU59IwBm/woIxqKJ6zqVOM4pfRd+5 k4415vL9PfL8faJkjVTuriQycQ5UQtGk7VPR+9YsMux5QHNhiC0= =6xv4 -----END PGP SIGNATURE----- --Apple-Mail=_1856C0FC-50F0-4B79-A01B-7FCF2A0DD024--