[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to add pseudo vector types
From: |
Fu Yuan |
Subject: |
Re: How to add pseudo vector types |
Date: |
Tue, 3 Aug 2021 09:08:04 -0400 |
> 在 2021年8月3日,上午9:03,Eli Zaretskii <eliz@gnu.org> 写道:
>
>
>>
>> From: Fu Yuan <casouri@gmail.com>
>> Date: Tue, 3 Aug 2021 08:50:45 -0400
>> Cc: stephen_leake@stephe-leake.org, cpitclaudel@gmail.com,
>> monnier@iro.umontreal.ca, emacs-devel@gnu.org
>>
>>> So in what sense are character positions easier to use than byte
>>> positions?
>>
>> Here are what you can do with positions:
>>
>> - find the smallest node that encloses a range (BEG . END)
>> - get the beginning and end of a node
>>
>> Since all other functions use character position (eg, put-text-property,
>> point), using character positions saves lisp code some ‘position-to-bytes’.
>
> If you are talking about Lisp, then yes, character positions are a
> much better interface. But on the C level, sometimes you need byte
> positions, sometimes character positions, and sometimes both. Since
> you didn't say what level was this about, I cannot say something more
> intelligent.
>
>> Internally, tree_sitter.c will continue to use byte positions, of course.
>
> "Internally", as opposed to what? And what is "internal" in this
> context? I thought we were talking only about the internals.
By internally I mean C level. I will change lisp interface functions to accept
and return character positions, and C level code will keep using byte positions.
I’ll try to make myself clearer next time :-)
Yuan
- Re: How to add pseudo vector types, Eli Zaretskii, 2021/08/03
- Re: How to add pseudo vector types, Fu Yuan, 2021/08/03
- Re: How to add pseudo vector types, Eli Zaretskii, 2021/08/03
- Re: How to add pseudo vector types, Fu Yuan, 2021/08/03
- Re: How to add pseudo vector types, Stefan Monnier, 2021/08/03
- Re: How to add pseudo vector types, Eli Zaretskii, 2021/08/03
- Re: How to add pseudo vector types, Yuan Fu, 2021/08/05
- Re: How to add pseudo vector types, Eli Zaretskii, 2021/08/06
- Tree-sitter api (Was: Re: How to add pseudo vector types), Fu Yuan, 2021/08/07
- Re: Tree-sitter api (Was: Re: How to add pseudo vector types), Eli Zaretskii, 2021/08/07