participle
participle copied to clipboard
feat: Add error recovery system
Implements error recovery inspired by Chumsky's recovery system in Rust, addressing GitHub issue #342.
Features:
- RecoveryStrategy interface with multiple implementations:
- SkipUntil/SkipPast: classic panic-mode recovery
- SkipThenRetryUntil: skip and retry parsing
- NestedDelimiters: balanced delimiter recovery
- TokenSyncStrategy: sync on token types
- CompositeStrategy: try multiple strategies in order
- RecoveryError type for multi-error reporting
- ParseOptions: Recover(strategies...) and MaxRecoveryErrors(n)
The implementation allows parsers to continue after errors, collecting multiple errors and producing partial ASTs - useful for IDE integration, linters, and comprehensive error messages.
Includes comprehensive test coverage (100% on new code) and example at _examples/recovery/.