[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: |
Tue, 03 Aug 2021 15:21:57 +0300 |
> From: Fu Yuan <casouri@gmail.com>
> Date: Tue, 3 Aug 2021 07:53:54 -0400
> Cc: stephen_leake@stephe-leake.org, cpitclaudel@gmail.com,
> monnier@iro.umontreal.ca, emacs-devel@gnu.org
>
> Oh no, I don’t mean that. I meant that, for example, functions like
> node_start_byte, which returns the byte position of the beginning of the
> node, will now be node_start_pos, which returns a point position.
That's called "character position". Let's use the accepted
terminology, to minimize misunderstandings.
So in what sense are character positions easier to use than byte
positions?
> And if I want the byte position of the beginning of the node, I can use
> (position-to-byte (tree-sitter-node-start-pos node))
Caveat: position-to-byte can be expensive. So in time-critical code,
such as the display engine, we keep both character position and byte
position, and update them in sync. Then you can use whichever is
easier in each case.
- 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