pegy 0.1.2

A derive based parser generator.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use pegy::Parse;

#[derive(Debug, Default, Parse)]
#[grammar($item0:['a'-'z''A'-'Z''0'-'9'])]
pub struct AlphaDigit(char);

#[derive(Debug, Default, Parse)]
#[grammar($item0:['0'-'9'])]
pub struct Digit(char);

#[derive(Debug, Default, Parse)]
#[grammar(!Digit $item0:AlphaDigit+)]
pub struct Ident(Vec<AlphaDigit>);

pub fn main() {
    let re: pegy::Result<Ident> = pegy::parse_blocking::<Ident, _>("myIdent");
    assert!(re.is_ok());
}