1
Fork 0
mirror of https://github.com/RGBCube/cstree synced 2025-07-28 17:47: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

@ -1,15 +1,15 @@
unstable_features = true
edition = "2018"
edition = "2021"
max_width = 120
max_width = 120
comment_width = 120
wrap_comments = true
format_code_in_doc_comments = true
format_macro_matchers = true
format_macro_matchers = true
imports_granularity= "Crate"
imports_granularity = "Crate"
reorder_impl_items = true