crisp-parser 1.8.0

Crisp parser — tokens to AST (spec Appendix A)
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use crisp_parser::Parser;

#[test]
fn parse_catch_expression() {
    let src = r#"
f() = read_config("x") catch _ -> Config { port: 0 }
"#;
    let mut parser = Parser::new(src).expect("parser");
    let file = parser.parse_file().expect("parse");
    let crisp_ast::item::Item::Function(f) = &file.items[0] else {
        panic!("expected function");
    };
    assert!(matches!(
        f.body.kind,
        crisp_ast::expr::ExprKind::Catch { .. }
    ));
}