[−][src]Crate nom_packrat
nom-packrat is an extension of nom to apply "Packrat Parsing".
Examples
The following example show a quick example.
use nom::character::complete::char; use nom::IResult; use nom_packrat::{init, packrat_parser, storage}; // Declare storage used by packrat_parser storage!(String); // Apply packrat_parser by custom attribute #[packrat_parser] pub fn parser(s: &str) -> IResult<&str, String> { let (s, x) = char('a')(s)?; Ok((s, x.to_string())) } fn main() { let input = "a"; // Initialize before parsing init!(); let result = parser(input); println!("{:?}", result); }
Macros
| init | Initialize packrat storage |
| storage | Declare packrat storage |
Structs
| PackratStorage |
Traits
| HasExtraState |
Attribute Macros
| packrat_parser | Custom attribute for packrat parser |