[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to add pseudo vector types

From: Eli Zaretskii
Subject: Re: How to add pseudo vector types
Date: Mon, 26 Jul 2021 21:55:41 +0300

> From: Yuan Fu <casouri@gmail.com>
> Date: Mon, 26 Jul 2021 13:09:13 -0400
> Cc: Stephen Leake <stephen_leake@stephe-leake.org>,
>  cpitclaudel@gmail.com,
>  monnier@iro.umontreal.ca,
>  emacs-devel@gnu.org
> > Which complexity does it add?  You just compare with BEGV_BYTE instead
> > of BEG_BYTE etc.
> We need to “delete” the hidden text and “re-insert” when we widen the buffer. 
> I’ll try to make it a no-op as long as we remember to widen before calling 
> tree-sitter to parse anything.

If some parser needs access to the whole buffer, its caller should
widen the buffer before calling the parser.

IOW, the control on which part of the buffer is visible to the parser
should be on the level of the caller of the parser, not at the level
of the function which accesses buffer text.

> > If we let TS look where it wants, we will lose the ability to restrict
> > it to a certain part of the buffer text.  This is needed at least for
> > some specialized modes, and is generally desirable, as it gives Lisp
> > programs an easy way to impose such restrictions whenever they need.
> Tree-sitter lets you set ranges for a parser to limit it self within, in 
> order to support multi-language files.

That's okay, but why would we want to expose this to Lisp as the means
to restrict the accessible portion, when we already have such a means?

reply via email to

[Prev in Thread] Current Thread [Next in Thread]