Expand description
A simple, fast, intuitive parser combinator framework for Rust.
§Get Started
use whitehole::{
combinator::eat,
parser::Parser,
};
// define the kind of the output
#[derive(Debug, Clone, PartialEq, Eq)]
enum Kind {
A,
}
let mut parser = Parser::builder() // create a parser builder
.entry(eat("a").bind(Kind::A)) // set the entry action
.build("a"); // build the parser with the input
let output = parser.next().unwrap(); // yield the next output
assert_eq!(output.value, Kind::A); // check the outputSee the combinator module to learn how to compose the entry action.
See the parser module to learn how to use the parser.
§Read the Source Code
Here is the recommended order to read the source code:
Modules§
- action
- The basic building block of a parser.
- combinator
Combinatoris a wrapper around anActionto provide decorators and operator overloads.- digest
- Digest-able byte sequence. See
Digest. - instant
- The instantaneous state of a parser (a.k.a the “configuration” in the automata theory).
See
Instant. - parser
- Manage the
State,Heapand the parsing progress. - range
- Utilities for working with byte ranges.
Macros§
- contextual
- Generate contextual combinators.