peg 0.8.6

A simple Parsing Expression Grammar (PEG) parser generator.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
extern crate peg;

peg::parser!(grammar test_grammar() for str {
    pub rule boundaries() -> String
        = n:$("foo") { n.to_string() }
});

use self::test_grammar::*;

// before we were testing string matches using .slice(), which
// threw an ugly panic!() when we compared unequal character
// boundaries.. this popped up while parsing unicode
#[test]
fn main() {
    assert!(boundaries("f↙↙↙↙").is_err());
}