polka 0.1.2

A dot language parser for Rust; based on Parser Expression Grammar (PEG) using the excellent pest crate as the underpinning.
Documentation
  • Coverage
  • 0%
    0 out of 99 items documented0 out of 44 items with examples
  • Size
  • Source code size: 67.8 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 6.64 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 17s Average build duration of successful builds.
  • all releases: 17s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • cloud-on-prem

Polka

A dot language parser for Rust; based on Parser Expression Grammar (PEG) using the excellent pest crate as the underpinning.


Usage (as a Rust Library)

  1. Add this to your Cargo.toml:
  [dependencies]
  rand = "0.6"
  1. Call the parser function by passing an input String
  extern crate polka;
  use polka::parse;

  fn main() {
    let input = "digraph { a -> b -> c }".to_string();
    println!("Polka AST\n: {:?}", parse(input).unwrap());
  }

  // Polka AST: 
  // Graph {
  //     strict: false,
  //     graph_type: Some(
  //         Digraph,
  //     ),
  //     id: None,
  //     statements: [
  //         EdgeStatement(
  //             EdgeStatement {
  //                 edge: NodeId(
  //                     NodeId {
  //                         node_id: "a",
  //                         port: None,
  //                     },
  //                 ),
  //                 edge_rhs_list: [
  //                     EdgeRhs {
  //                         edge_op: Arrow,
  //                         edge: NodeId(
  //                             NodeId {
  //                                 node_id: "b",
  //                                 port: None,
  //                             },
  //                         ),
  //                     },
  //                     EdgeRhs {
  //                         edge_op: Arrow,
  //                         edge: NodeId(
  //                             NodeId {
  //                                 node_id: "c",
  //                                 port: None,
  //                             },
  //                         ),
  //                     },
  //                 ],
  //                 attributes: None,
  //             },
  //         ),
  //     ],
  // }

Known Limitations:

  1. HTML ids are currently not supported.

License

MIT