1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
// pest. Smart PEGs in Rust // Copyright (C) 2016 Dragoș Tiselice // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. //! # pest. Smart PEGs in Rust //! //! pest is a parser generator that works with //! [PEGs](https://en.wikipedia.org/wiki/Parsing_expression_grammar). //! //! It relies exclusively on macros to create an efficient parser at compile-time. //! //! ``` //! # #[macro_use] extern crate pest; //! # use pest::Input; //! # use pest::StringInput; //! # use pest::Rdp; //! # fn main() { //! impl_rdp!(MyRdp); //! //! impl MyRdp { //! grammar! { //! exp = { paren ~ exp | [""] } //! paren = { ["("] ~ exp ~ [")"] } //! } //! } //! //! let mut parser = MyRdp::new(Box::new(StringInput::new("(())((())())()"))); //! //! assert!(parser.exp()); //! assert!(parser.end()); //! # } //! ``` #[macro_use] mod parsers; mod grammar; mod input; mod inputs; mod parser; pub use input::Input; pub use inputs::StringInput; pub use parser::Parser; pub use parsers::Rdp;