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: Creating a paradigm for leveraging Tree Sitter's power Date: Sat, 24 Dec 2022 08:32:38 -0600 Message-ID: <5F05BACE-A31A-48EF-94FF-7F9B0DF663AE@easesoftware.com> References: <948662B3-F284-4E89-BFE2-4BCB5007D4EA@easesoftware.com> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.200.110.1.12\)) Content-Type: multipart/signed; boundary="Apple-Mail=_E3F221BC-A62D-4C8F-9A4F-18131BAF385D"; protocol="application/pgp-signature"; micalg=pgp-sha256 Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11855"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel To: Yuan Fu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Dec 24 15:33:53 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 1p95az-0002tM-EW for ged-emacs-devel@m.gmane-mx.org; Sat, 24 Dec 2022 15:33:53 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p95aB-0008Ds-Rt; Sat, 24 Dec 2022 09:33:03 -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 1p95a9-0008Da-0K for emacs-devel@gnu.org; Sat, 24 Dec 2022 09:33:02 -0500 Original-Received: from dragonfly.birch.relay.mailchannels.net ([23.83.209.51]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p95a6-0002dc-Pj for emacs-devel@gnu.org; Sat, 24 Dec 2022 09:33: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 736B354042C; Sat, 24 Dec 2022 14:32: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 C8BD1541101; Sat, 24 Dec 2022 14:32:51 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1671892372; a=rsa-sha256; cv=none; b=ElaUmRX4bhTPHqHEuFKQqqPAKsHQFsM1McEYit7poJ4cyCWrUxLhjiHRbNCCbQyXR1yp8k wCIUC1uegxR8CLDXg91O4gdAT/ov1aE4zOP0GnIGQnesIN0UIHtyNhhJdSPctdGcaNYgul vL/EJHHMVoTaF27CgshPgXaoKSZh8lkGdU5ReOlbwsZAsd7Wd1QvnuLnwXlYZKAXJheeVI 5aC2wpnJmWqPrieWzuGUymvPoIDRNTO570xb9MWmgA3/wOdc5qB2OoSiX/A8AHeELqtXW3 2CW7Gd9oe6TXlIiWVvGNVK9LVsMahoSOfkPyMECs7XwAPW93d8i7U1rzInEpKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1671892372; 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=HY2ph3znJTy4dWaJ+E/YakjkDtMhijerpvoY82NreOw=; b=exBNe3U4yYul8BAsJ0tNk5HOHPoeMgJIcjInIC6SEnIgPnuTmArn+dNjRX4o7B2OVj/V0H OypEyeISwbd80seX2V5HyiIXL6ylWBwsMIxzjoeMdVXSy0QZ3u27KBGEZyxoQT1FMmU3Cv UspHsDLRsLC2CqF6ggqlXEnDjcirEUDaDX0vhUFuTMYe68QGtZ54T8sS8cizapI5n+haL7 RNMgdUO8EVOA3YNFsSg1RO0Jok/HAuPZMUu9bCLLfNo433L7Ybt3uAKF0/HKNRED0+wAeE ov8/V94TZ+Q4kapepdDrdDSOtRogrUBFk/9V7xY+FdjOZmuTIbbzZJ47QFuf5g== ARC-Authentication-Results: i=1; rspamd-698c4479bb-25npm; 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-Hook-Industry: 2e781ae93aa182a6_1671892372241_688467395 X-MC-Loop-Signature: 1671892372241:1694005706 X-MC-Ingress-Time: 1671892372241 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.107.134.72 (trex/6.7.1); Sat, 24 Dec 2022 14:32:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=easesoftware.com; s=default; h=To:References:Message-Id:Cc:Date:In-Reply-To :From:Subject:Mime-Version:Content-Type: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=HY2ph3znJTy4dWaJ+E/YakjkDtMhijerpvoY82NreOw=; b=BHNdBJpCfP8/GSFXZGyNG1V91E NcPU54YEvSildHRR1K42n/GLJfqYfjGezhs5XIKmRPFyyOO5O59CPQ72/s3Y3pNW6aqqbJRaqe4tk VImaliQn5dET4e64lUyrRAajGTUvRMEmg9/zaS0DJ0X7ZAazIgTGLBC7p07F+NIlmQmSPt7RV+/Ck F8+6Zp4Udw7yE5MgrVgZM4ZNRsYfhO6avuWxndBg3OzJwklXb+VkypTg3ykdVmKzLs6r1hOAjfniC 0p4O/gNsexWInTDb8i7oau0DeU0Zl3hSdSvDtaBmymAL9CULvj5H907GSvcMQjBRPmxGZGd9r++qZ 1njhiVcw==; Original-Received: from cpe-70-94-128-193.satx.res.rr.com ([70.94.128.193]:56169 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 1p95Zy-001tQY-Mg; Sat, 24 Dec 2022 09:32:50 -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.209.51; envelope-from=pedz@easesoftware.com; helo=dragonfly.birch.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, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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:301841 Archived-At: --Apple-Mail=_E3F221BC-A62D-4C8F-9A4F-18131BAF385D Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Dec 24, 2022, at 03:09, Yuan Fu wrote: >=20 >> On Dec 23, 2022, at 5:32 PM, Perry Smith = wrote: >=20 >>=20 >> I'll call this the "primitive routine". The routine would be >> responsible for returning a beginning and end (in a cons cell) and it >> would be the routine's responsibility to make sure that the beginning >> and end lie after (in the forward case) or before (in the backward >> case) the point that is passed in. >=20 > You mean beginning and end of (symbol | string | statement | =E2=80=A6)?= Yes. A =E2=80=9Csimple=E2=80=9D routine for each concept that the = language has that would Return the beg / end of that construct. e.g. foo-bar-statement would return the beg / end of a statement. > =46rom my experience implementing defun navigation for tree-sitter, it = might be more helpful to return three ranges: the thing before point, = the thing at point, and the thing after point, and either one could be = nil if there doesn=E2=80=99t exist one. For nested things it can be = prev-sibling, parent, next-sibling instead. The point is that the user = can move back and forward and make decisions easily with this =E2=80=9Cfie= ld of view=E2=80=9D. Hmm=E2=80=A6 interesting idea. As I work on things I=E2=80=99ll keep = this idea in mind. It might indeed lead to simpler routines. Perry --Apple-Mail=_E3F221BC-A62D-4C8F-9A4F-18131BAF385D 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+MAFAmOnDYYACgkQjxzk9yzE +MA4Yg//biG7xUtvNfDy5uDyvc5uSXg+5id8B0crTHuBCuhY296Czk4y+7RdrOUm s0bJPHmGrtWwb8DmH18g8mRpVqF3ENj3iJFYHvVCFuRLOKChMwjR7MrGajLuXzgH Uk0LLXZtdINCAcwb2yT2y89GHcz7rC6Kw/p6dol+w+SLP4/LcFBTybKH0N3Quaos q9R2GeeJLtQxO4qTChHVWQ5jpIZ9KFWdVxdr446QEz/lOVohprHjcQGUb5xStY+w wHbRpAUcyXCybNSCuW68uMhxCYMFsbWXDErvKRLUEZFCk7bPS3bJmTX0iUVIJIZ+ 5HlBLXMaKEgLe5t4rk7sHZzv8jbDvTPRNu1hyP1WmzhwiIj9cBoeapV04yNnESEs AXVIvRKo5HXwPEp9liJs2OhuXMXw/5OPASGNVT8j/JyJyfKp+AYRrHOXWDkzFKEA O8iGspijXrbeo5XQpQSl89ZPJEX5xLW4OBN0Jv+UoajxQGGl1ekCkY9w7l1hf5A1 VgduDK8dowAmwFhl3RvFYY30LjpXwGvHmsZNkj3BxwvOIBKq9LRHukN7hzpYCbUK JRAzGZR+Yuxm7/aGeRUh9mfbRUZ1NCWIX9TgUQ9Jl5HF6X6nUtDdInwapD2e27qW ol6rpbKZ1Fm4MVcQswMx90ZQEnbllaVC6rg/Ygyck4NQRNKrqgI= =g0Z4 -----END PGP SIGNATURE----- --Apple-Mail=_E3F221BC-A62D-4C8F-9A4F-18131BAF385D--