Parse PDL file for the Chrome DevTools Protocol.
NOTE: PDL
(pronounced as ˈpo͞odl
) is a home-grown format to describe the DevTools protocol. PDL support, such as Sublime syntax highlighting and the json converter, is available at https://github.com/pavelfeldman/pdl.
To use pdl
in your project, add the following to your Cargo.toml:
toml
[dependencies]
pdl = "0.1"
Use pdl::parse
to parse a PDL file as strongly typed data structures.
```rust let mut f = File::open("browserprotoco.pdl")?; let mut s = String::new(); f.readto_string(&mut s)?;
let (rest, proto) = pdl::parse(&s)?;
println!("PDL: {}", proto); println!("JSON: {}", proto.tojsonpretty()); ```
For more detail, please check the parser
example.
sh
$ cargo run --example parser -- browser_protocol.pdl --json --output browser_protocol.json