xidl-parser 0.55.0

A IDL codegen.
Documentation
const TEST_CASES: &[(&str, &str)] = &[(
    "interface_dcl",
    r#"
        interface HelloWorld;
        interface HelloWorld {};

        interface HelloWorld: Parent {};
        interface HelloWorld: Parent1, Parent2, Parent3 {};

        interface A: B, C, D {
            void func1();
            void func1() raises(A);
            void func1() raises(A,B,C);
            void func1(@key in u8 attr, out u16 attr);
            void func1(in u8 attr, out u16 attr) raises(A);
            void func1(in u8 attr, out u16 attr) raises(A,B,C);
            readonly attribute u8 attr1, attr2, attr3;
            readonly attribute u8 attr1 raises(A);
            readonly attribute u8 attr1 raises(A, B, C);
            attribute u8 attr1, attr2, attr3;
            attribute u8 attr1 getraises(A);
            attribute u8 attr1 getraises(A, B, C) setraises(A);
            attribute u8 attr1 setraises(A);
        };

        interface A {
            typedef long L1; // idl 7.4.4
            const int a = 10; // idl 7.4.4
            exception A { // idl 7.4.4
                int a;
            };
            short opA(in L1 l_1);
        };
    "#,
)];

#[test]
fn test_typed_ast() {
    for (name, text) in TEST_CASES {
        let ast = xidl_parser::parser::parser_text(text).unwrap();
        let snapshot = format!("typed_ast__{name}");
        insta::assert_debug_snapshot!(snapshot, ast);
    }
}

#[test]
fn test_hir() {
    for (name, text) in TEST_CASES {
        let typed = xidl_parser::parser::parser_text(text).unwrap();
        let hir = xidl_parser::hir::Specification::from(typed);
        let snapshot = format!("hir__{name}");
        insta::assert_debug_snapshot!(snapshot, hir);
    }
}