File: example.rs

package info (click to toggle)
rust-abnf 0.13.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 272 kB
  • sloc: makefile: 2
file content (19 lines) | stat: -rw-r--r-- 380 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
use std::error::Error;

use abnf::rulelist;

fn main() -> Result<(), Box<dyn Error>> {
    let rules = {
        let path = std::env::args().nth(1).ok_or("No path to file given.")?;
        let data = std::fs::read_to_string(path)?;

        rulelist(&data)?
    };

    for rule in &rules {
        println!("// {}", rule);
        println!("{:#?}\n", rule);
    }

    Ok(())
}