emacs-devel
[Top][All Lists]
Advanced

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

Re: Tree Sitter (was Re: cc-mode fontification feels random)


From: Stefan Monnier
Subject: Re: Tree Sitter (was Re: cc-mode fontification feels random)
Date: Tue, 20 Jul 2021 21:28:44 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

> Alternately, you can only store the length of each token (as tree-sitter
> does); then when processing queries, you have to add up all the lengths
> of the preceding tokens in order to report the buffer position of the
> information you are computing. That is also linear in the length of the
> buffer.

You can probably get better than linear performance in "the usual case"
by storing the total length of the subtree at each node of the AST.
It's still theoretically linear in the worst case, of course.


        Stefan




reply via email to

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