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: How to add pseudo vector types Date: Thu, 15 Jul 2021 12:26:25 -0400 Message-ID: <55D3D29F-E61B-404D-A9A1-E850C0B816C1@gmail.com> References: <83h7gw6pyj.fsf@gnu.org> <45EBF16A-C953-42C7-97D1-3A2BFEF7DD01@gmail.com> <83y2a764oy.fsf@gnu.org> <83v95b60fn.fsf@gnu.org> <00DD5BFE-D14E-449A-9319-E7B725DEBFB3@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.60.0.2.21\)) Content-Type: multipart/alternative; boundary="Apple-Mail=_FFE95052-DED8-40C0-8B24-560A7A69C18C" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34570"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Stefan Monnier , emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Jul 15 18:27:48 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 1m44DD-0008ra-Kj for ged-emacs-devel@m.gmane-mx.org; Thu, 15 Jul 2021 18:27:47 +0200 Original-Received: from localhost ([::1]:56922 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m44DC-00088C-Ks for ged-emacs-devel@m.gmane-mx.org; Thu, 15 Jul 2021 12:27:46 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50710) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m44By-00070B-Uj for emacs-devel@gnu.org; Thu, 15 Jul 2021 12:26:32 -0400 Original-Received: from mail-qv1-xf2d.google.com ([2607:f8b0:4864:20::f2d]:36838) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m44Bw-0000fk-Fe; Thu, 15 Jul 2021 12:26:30 -0400 Original-Received: by mail-qv1-xf2d.google.com with SMTP id gh6so3116845qvb.3; Thu, 15 Jul 2021 09:26:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=br1UiyKw0TkzTk5zOF+TrpElkQ+UcaAraoKLcENNHkg=; b=uIGv5QskzD44QdaYnPlG3deYpGLZ+dFKHAWwB5hhabKPxteIJHLv14wHQ5DcKIrCPN NjBdwnbZObdkjBAZAcMMpKnNUuIi/KxCNMAdb2KBqOZ3sjBn4cb5hFYkVlB7aKQGvo36 FSVdXGCboEgEuTZKrlBpwfmjfXJncQnLRLXEKUqs0F/X5c3CtTLMFien1nvKSUK7qF8C fYxoFuZknRDvllwkXiCVKtqzZACH8f0A6eot/QSg/d+O+E4NiVlwdmHkjFCmyj30pHyv MpNGcGGut2C1uOaHwToWMRwUfXepHp4Px9akWaypBD01PCb1KGzdkzpMYNZbxhPCnrqz woxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=br1UiyKw0TkzTk5zOF+TrpElkQ+UcaAraoKLcENNHkg=; b=Ju2m9GIvZmyZP42MF0bFpARsC93sMhaXnB3M7rMdYFM5VNFeSfEvxXX9R2tRkfDDol Wu7fN2DA9XQx9/f2JRU0mMYn4X+FhI0kw/nTt9Y/yopR4QLtioP4nshwKxwbgAVcuzrE BA+X24yL9N2As2FDIAYtn0pk7vHYlo0McoLGIelRq/3TebOrMWyKRXieiEkg9VT3ydg8 tGdaoKmJvPhpp777NbFRVL6NIt795e9f/+8KTyfVUqyrs6LLhG4Oc1n4Ows1t34B0EOz qHsQz49cTPE4VixS7+OQ120G1ExsdxsP2cRtzivgj5lA2klIvC8kuiHnE3jGez1deN18 2neg== X-Gm-Message-State: AOAM533AIQfjU0Yr8uZ6EjtNOUdmtCcNgi2KjnieGXJe/k3aJx2V+fix +epOoyEtX9amW6AWpX73dIjIGBxIbqSi+w== X-Google-Smtp-Source: ABdhPJw0EzupokeB5om7ggI0UCkCQeVgv5Lydk8pcBVE9XuxwPvW6hXSjfcj70MlKakBXUWx1NmXcQ== X-Received: by 2002:ad4:5426:: with SMTP id g6mr5153571qvt.47.1626366386961; Thu, 15 Jul 2021 09:26:26 -0700 (PDT) Original-Received: from ?IPv6:2601:98a:4200:9210:b02d:e0d8:dab6:21b? ([2601:98a:4200:9210:b02d:e0d8:dab6:21b]) by smtp.gmail.com with ESMTPSA id 67sm2207223qtf.83.2021.07.15.09.26.25 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Jul 2021 09:26:26 -0700 (PDT) In-Reply-To: <00DD5BFE-D14E-449A-9319-E7B725DEBFB3@gmail.com> X-Mailer: Apple Mail (2.3654.60.0.2.21) Received-SPF: pass client-ip=2607:f8b0:4864:20::f2d; envelope-from=casouri@gmail.com; helo=mail-qv1-xf2d.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, HTML_MESSAGE=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.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:271264 Archived-At: --Apple-Mail=_FFE95052-DED8-40C0-8B24-560A7A69C18C Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 >=20 >>=20 >>> And, for tree-sitter to take the buffer=E2=80=99s content directly, = we need to tell it to skip the gap. >>=20 >> AFAIR, tree-sitter allows the calling package to provide a function = to >> access the text, isn't that so? If so, you could write a function >> that accesses buffer text via BYTE_POS_ADDR etc., and that knows how >> to skip the gap already. >=20 > Yes, that function returns a char*. But what if the gap is in the = middle of the portion that tree-sitter wants to read? Alternatively, we = can copy the text out and pass it to tree-sitter, but you don=E2=80=99t = like that, IIRC. Or we can only copy out when the portion tree-sitter wants encompasses = the gap, I expect this case to be relatively rare so we won=E2=80=99t = copy out all the time, and most of the time tree-sitter just reads from = the buffer directly. Yuan= --Apple-Mail=_FFE95052-DED8-40C0-8B24-560A7A69C18C Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8


And, for tree-sitter to = take the buffer=E2=80=99s content directly, we need to tell it to skip = the gap.

AFAIR, tree-sitter = allows the calling package to provide a function to
access = the text, isn't that so?  If so, you could write a function
that accesses buffer text via BYTE_POS_ADDR etc., and that = knows how
to skip the gap already.

Yes, that function returns a char*. But what if the gap is in = the middle of the portion that tree-sitter wants to read? Alternatively, = we can copy the text out and pass it to tree-sitter, but you don=E2=80=99t= like that, IIRC.

Or we can only copy out when the portion = tree-sitter wants encompasses the gap, I expect this case to be = relatively rare so we won=E2=80=99t copy out all the time, and most of = the time tree-sitter just reads from the buffer directly.

Yuan
= --Apple-Mail=_FFE95052-DED8-40C0-8B24-560A7A69C18C--