typescript_webidl/
debug.rs1use crate::parse;
3
4pub fn debug_parse() {
6 let webidl1 = r#"interface TestInterface { void test(); };"#;
8 let webidl2 = r#"interface TestInterface {
9 void test();
10};
11"#;
12 let webidl3 = r#"module TestModule {
13 interface TestInterface {
14 void test();
15 };
16};
17"#;
18
19 let webidls = vec![("Simple", webidl1), ("Formatted", webidl2), ("Module", webidl3)];
20
21 for (name, webidl) in webidls {
22 println!("\nTesting typescript_webidl parser with {} format...", name);
23 println!("Input: {}", webidl);
24
25 match parse(webidl) {
26 Ok(root) => {
27 println!("Parsing successful!");
28 println!("Items count: {}", root.items.len());
29 for (i, item) in root.items.iter().enumerate() {
30 println!("Item {}: {:?}", i, item);
31 }
32 }
33 Err(error) => {
34 println!("Parsing failed: {}", error);
35 }
36 }
37 }
38}