goffrie / plex

a parser and lexer generator as a Rust procedural macro
Apache License 2.0
409 stars 26 forks source link

supporting error recovery? #32

Open richox opened 6 years ago

richox commented 6 years ago

error recovery is important for practical parser, is there any plan that plex will support it? for example, when we are failed to parse a statement, we skip remaining tokens until we met a semicolon:

program {
    => vec![],
    => program[mut z1] statement[z2] => {z1.push(z2); z1},
}
statement {
    expression[z1] Semicolon => Statement::Expression(z1),
    .* Semicolon => Statement => Statement::Error,
}