Crate pest [] [src]

pest. Smart PEGs in Rust

pest is a parser generator that works with PEGs.

It relies exclusively on macros to create an efficient parser at compile-time.

impl_rdp! {
    grammar! {
        exp = { paren ~ exp | [""] }
        paren = { ["("] ~ exp ~ [")"] }
    }
}

let mut parser = Rdp::new(Box::new(StringInput::new("(())((())())()")));

assert!(parser.exp());
assert!(parser.end());

Macros

grammar!

A macro that defines each rule as a method on a Parser. Rules starting with an uderscore will not be placed into the queue.

impl_rdp!

A macro useful for implementing the Parser trait as a recursive descent parser.

Structs

Queues

A struct which caches VecDeques.

StringInput

A struct useful for matching in-memory Strings.

Traits

Input

A trait that defines an input for a Parser.

Parser

A trait that defines a parser.