1 unstable release

0.1.0 Dec 17, 2024

#112 in Parser tooling

Download history 129/week @ 2024-12-13 12/week @ 2024-12-20 1/week @ 2025-01-03

142 downloads per month

MIT license

38KB
802 lines

microparsec

A simple parser crate for Rust.

How to use

Look at the documentation to see how to use each parser.

Example

use microparsec::{ParserRc, SpacesParser, StringParser, SequenceParser, StringParserT, ContextParserT, parsers};

let hello_parser = StringParser::new("Hello");
let spaces_parser = SpacesParser::new();
let world_parser = StringParser::new("World");
let res = SequenceParser::new(parsers!(hello_parser, spaces_parser, world_parser)).parse("Hello  World");

assert_eq!(
    res.unwrap().val,
    vec!["Hello".to_string(), "  ".to_string(), "World".to_string()]
);

Dependencies

~2–3MB
~53K SLoC