Debian Codegraph @

tests/run-pass/bytes.rs

raw symbols SCIP
1 extern crate peg;
2 use peg::parser;
3
4 parser!{
5 grammar byteparser() for [u8] {
6 pub rule commands() -> Vec<&'input[u8]> = command()*
7 rule command() -> &'input [u8] = ">" val:$([b' ' ..= b'~']+) [0] { val }
8 }
9 }
10
11 fn main() {
12 assert_eq!(byteparser::commands(b">asdf\0>xyz\0"), Ok(vec![&b"asdf"[..], &b"xyz"[..]]));
13 }