1
Fork 0
mirror of https://github.com/RGBCube/cstree synced 2025-07-29 18:17:44 +00:00

Support backtracking and Checkpoints across nodes (#68)

* Add [`GreenTreeBuilder::revert`] to support backtracking parsers

Rowan, and hence CSTree, is designed around hand-written parsers.
In particular, the APIs for *building* trees require that each token is recorded only once.

Some parsers, and especially parser combinators, use backtracking instead, where the same token may be seen multiple times.
To support this, add a new `revert` function which discards all tokens seen since the last checkpoint.

* allow checkpointing across nodes (within reason)

* clean up asserts and expand documentation

* add Changelog entry

* prepare v0.12.2 release

---------

Co-authored-by: jyn <github@jyn.dev>
Co-authored-by: Domenic Quirl <DomenicQuirl@protonmail.com>
This commit is contained in:
DQ 2024-11-01 13:47:49 +01:00 committed by GitHub
parent 7f8515844d
commit d602fe22eb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 491 additions and 23 deletions

View file

@ -8,7 +8,7 @@ resolver = "2"
[workspace.package]
edition = "2021"
version = "0.12.1" # when updating, also update `#![doc(html_root_url)]` and any inter-crate dependencies (such as `cstree`'s dependency on `cstree-derive`)
version = "0.12.2" # when updating, also update `#![doc(html_root_url)]` and any inter-crate dependencies (such as `cstree`'s dependency on `cstree-derive`)
authors = [
"Domenic Quirl <DomenicQuirl@pm.me>",
"Aleksey Kladov <aleksey.kladov@gmail.com>",