From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stephen Leake Newsgroups: gmane.emacs.devel Subject: Re: How to add pseudo vector types Date: Mon, 26 Jul 2021 23:13:13 -0700 Message-ID: <86fsw05lom.fsf@stephe-leake.org> References: <83h7gw6pyj.fsf@gnu.org> <1AAB1BCC-362B-4249-B785-4E0530E15C60@gmail.com> <83czri67h0.fsf@gnu.org> <46BBFF88-76C3-4818-8805-5437409BEA93@gmail.com> <83wnpq46uk.fsf@gnu.org> <533BD53B-4E85-4E9E-B46A-346A5BBAD0F5@gmail.com> <258CB68D-1CC1-42C8-BDCD-2A8A8099B783@gmail.com> <1a776770-50b7-93cd-6591-c9a5b3a56eb8@gmail.com> <8335s64v10.fsf@gnu.org> <5380C92B-6C15-4490-A1E0-1C3132DBB16A@gmail.com> <83k0li2shw.fsf@gnu.org> <86wnpg82v3.fsf@stephe-leake.org> <83lf5wyn0z.fsf@gnu.org> <86pmv66yqg.fsf@stephe-leake.org> <83a6maw705.fsf@gnu.org> <83r1fluikh.fsf@gnu.org> <88007ACB-31E5-440F-876D-9F43C8EE02CC@gmail.com> Mime-Version: 1.0 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="1795"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (windows-nt) Cc: Eli Zaretskii , emacs-devel@gnu.org, cpitclaudel@gmail.com, monnier@iro.umontreal.ca To: Yuan Fu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Jul 27 08:14:13 2021 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 1m8GM0-0000Es-Bw for ged-emacs-devel@m.gmane-mx.org; Tue, 27 Jul 2021 08:14:12 +0200 Original-Received: from localhost ([::1]:43312 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m8GLy-0006ZV-2N for ged-emacs-devel@m.gmane-mx.org; Tue, 27 Jul 2021 02:14:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48538) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m8GLA-0005sO-FA for emacs-devel@gnu.org; Tue, 27 Jul 2021 02:13:20 -0400 Original-Received: from gateway23.websitewelcome.com ([192.185.50.104]:37265) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m8GL8-0003rP-G5 for emacs-devel@gnu.org; Tue, 27 Jul 2021 02:13:20 -0400 Original-Received: from cm16.websitewelcome.com (cm16.websitewelcome.com [100.42.49.19]) by gateway23.websitewelcome.com (Postfix) with ESMTP id 764C0F723 for ; Tue, 27 Jul 2021 01:13:16 -0500 (CDT) Original-Received: from host2007.hostmonster.com ([67.20.76.71]) by cmsmtp with SMTP id 8GL6m4rMvjSwz8GL6mqamP; Tue, 27 Jul 2021 01:13:16 -0500 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=stephe-leake.org; s=default; h=Content-Transfer-Encoding:Content-Type: MIME-Version:Message-ID:In-Reply-To:Date:References:Subject:Cc:To:From:Sender :Reply-To: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=hrB/7V1NL9LbLrBDMAjEHM+bwkyA6shZUJJv3DuTEK0=; b=eYI9HABaxtfJzT6RGT69uQCIMr n7zMukhzEfbq09LAH1Kr4Qu7dKny60o3YMUtzZseUOE1YpRTOAF//mNow7Fr0Q4FmhGJRBEtUuhhY oFBqHWmWWWWizNFuavIyJ8LL2oDTZfArZSAmdtJa2yZw9wI9shZzkU0VsU9ZDtj7WkNybPjkfNmYp Q3+eYjPIYAH7itTSObsRZHDOqMS1T90GK0gJZ1OhRDEUEXkHKwSOS19uTIeXgdBJG6p/epzeHpqzx IiSPayvHCM1ZT6Umqw5fJ+z6W5BiCWVk/Q/hg5qtocSgwq+bNlBvjU1ipc+Z+BXgCXTIO/ZtyIsop VSRWri5A==; Original-Received: from [76.77.182.20] (port=61849 helo=Takver4) by host2007.hostmonster.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1m8GL5-000Nbp-NA; Tue, 27 Jul 2021 00:13:15 -0600 In-Reply-To: <88007ACB-31E5-440F-876D-9F43C8EE02CC@gmail.com> (Yuan Fu's message of "Mon, 26 Jul 2021 13:09:13 -0400") X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - host2007.hostmonster.com X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - stephe-leake.org X-BWhitelist: no X-Source-IP: 76.77.182.20 X-Source-L: No X-Exim-ID: 1m8GL5-000Nbp-NA X-Source-Sender: (Takver4) [76.77.182.20]:61849 X-Source-Auth: stephen_leake@stephe-leake.org X-Email-Count: 5 X-Source-Cap: c3RlcGhlbGU7c3RlcGhlbGU7aG9zdDIwMDcuaG9zdG1vbnN0ZXIuY29t X-Local-Domain: yes Received-SPF: permerror client-ip=192.185.50.104; envelope-from=stephen_leake@stephe-leake.org; helo=gateway23.websitewelcome.com X-Spam_score_int: -8 X-Spam_score: -0.9 X-Spam_bar: / X-Spam_report: (-0.9 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-0.001, SPF_NEUTRAL=0.779 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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" Xref: news.gmane.io gmane.emacs.devel:271683 Archived-At: Yuan Fu writes: >>>=20 >>>> Once again, we are talking about the function used by TS to read >>>> buffer text. Not about the parser or its caller. Low-level code, >>>> which knows nothing about the context, should never look beyond the >>>> restriction. >>>=20 >>> It doesn=E2=80=99t harm for tree-sitter to see the rest of the buffer, = it >>> doesn=E2=80=99t modify anything, all it does it reading the text. OTOH, >>> restricting tree-sitter to the bounds of narrows adds complexity >>> for no benefit (as far as I can see). >>=20 >> Which complexity does it add? You just compare with BEGV_BYTE instead >> of BEG_BYTE etc. > > We need to =E2=80=9Cdelete=E2=80=9D the hidden text and =E2=80=9Cre-inser= t=E2=80=9D when we widen the > buffer. I=E2=80=99ll try to make it a no-op as long as we remember to wid= en > before calling tree-sitter to parse anything. First, the only thing TS deletes is tree nodes, not text; it does not have a copy of the buffer. Why do you think we need to delete the tree nodes corresponding to the hidden text? They provide exactly the context needed to parse the visible text properly. This assumes the narrowing is temporary, not for a multi-major-mode. --=20 -- Stephe