Incremental parsing API?

Hi, Lezer looks awesome.

The blog post mentions that it can do incremental re-parses, i.e. given an old parse tree and an edit to the source string, do a minimal amount of work to find the new parse tree. However, I don’t see an API in the reference for doing this. Is there a way that I’m missing? Thanks.

Tree-sitter’s API for this looks like this: Tree-sitter|Using Parsers

Yeah, that’s a bit obscure and should probably get a section in the guide. The idea is to pass a context with a fragments field holding an array of TreeFragments (created from the previous parse tree, possibly mangled with applyChanges).

1 Like