Open bew opened 2 years ago
Adding on, it would also be nice to see an example of how to construct a partial syntax tree with Error
nodes like in the README screenshot. It seems like none of the current examples do this and it is crucial to having a good IDE experience
Currently, the following examples do parser error recovery:
There is also documentation on Parser::recover_with
, the main method used to invoke recovery.
It's true that this is somewhat hard to find though: the recovery
module docs should probably point to it and give a little overview of the various recovery options available.
nested_delimiters
works great but I'm not sure to how apply the other strategies. For example, say I have a statement parser that is separtated_by(Semicolon)
. How could I recover valid statements with syntax errors in-between? Or, at least recover statements before a syntax error?
How could I recover valid statements with syntax errors in-between?
skip_until
will probably serve your needs.
I'm intending to refactor the recovery system when zero-copy
merged to make it more flexible and easier to work with.
AFAIK there's not a lot of documentation (except few lines), nor examples on how to use the recovery module and the
parse_recovery_*
functions https://docs.rs/chumsky/latest/chumsky/recovery/index.htmlEspecially on the functions
nested_delimiters
skip_then_retry_until
skip_until