microparsec

Crates.iomicroparsec
lib.rsmicroparsec
version0.1.0
created_at2024-12-17 00:49:54.027879+00
updated_at2024-12-17 00:49:54.027879+00
descriptionA simple parser combinator crate for Rust.
homepage
repositoryhttps://github.com/ComicalCache/parser-combinator
max_upload_size
id1485665
size54,038
ComicalCache (ComicalCache)

documentation

README

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()]
);
Commit count: 28

cargo fmt