Add a new ParserExtra::State: Inspector
trait
#681
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This allows using imperative concrete syntax tree parsers like
rowan
andcstree
. In particular those libraries want to know every token that is parsed, and need to know when chumsky backtracks and reparses the same tokens again.This adds the following new API surface:
and additionally now requires
ParserExtra::State: Inspector
.i didn't write any of my own tests yet but my own parser that hooks chumsky up to cstree does work: spreadsheet-lang/spreadsheet@1b97313#diff-14962dfdd56397d99e07041d6337cb5b0327f4d7433d80fd3383955415014910R111
Fixes #96