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
49
50
51
52
53
54
55
56
57
58
//! See the
//! [README.md](https://gitlab.com/wake-sleeper/parser-compose/-/blob/main/README.md?ref_type=heads)
//! for a crash course in parser combinators.
//!
//! The crate is logically organized into two parts
//!
//! ## Parsers
//!
//! Any rust items that implement the [Parser](crate::parser::Parser) trait can parse input by
//! calling [try_parse()](crate::parser::Parser::try_parse)
//!
//! - [`&str`](crate::parser::Parser#impl-Parser<%26'input+str,+%26'pat+str,+()>-for-%26'pat+str)
//! - [`slice`s](crate::parser::Parser#impl-Parser<%26'input+[T],+%26'pat+[T],+()>-for-%26'pat+[T])
//! - [`any_str`](crate::parser::any_str)
//! - [`any_byte`](crate::parser::any_byte)
//! - [`ascii_str`](crate::parser::ascii_str)
//! - [`byte`](crate::parser::byte)
//!
//! Additionally, [any function with the right signature](crate::parser::Parser#impl-Parser<In,+Out,+E>-for-F) automatically becomes a parser.
//!
//!
//! ## Parser combinators
//!
//! The associated methods on the [Parser](crate::parser::Parser) trait are used to combine with
//! other parsers.
//!
//! - [`or()`](crate::parser::Parser::or)
//! - [`when()`](crate::parser::Parser::when)
//! - [`repeated()`](crate::parser::Parser::repeated)
//! - [`map()`](crate::parser::Parser::map)
//! - [`map_err()`](crate::parser::Parser::map_err)
//! - [`peeked()`](crate::parser::Parser::peeked)
//! - [`and_then()`](crate::parser::Parser::peeked)
//! - [`optional()`](crate::parser::Parser::optional)
//!
//! The sequence combinator is so common that it has a special form. [Tuples of parsers implement
//! `Parser`](crate::parser::Parser#impl-Parser<In,+(O0,+O1),+E>-for-(P0,+P1)) such that the tuple parser succeeds if all its parsers succeed.
//!
//! ## Examples
//!
//! Checkout the [integration test
//! directory](https://gitlab.com/wake-sleeper/parser-compose/-/tree/main/tests) for concrete
//! parsing examples.

mod parser;
mod result;

#[doc = include_str!("../README.md")]
#[cfg(doctest)]
pub struct ReadmeDocTests;

pub use parser::Parser;
pub use parser::{any_byte, any_str, ascii_str, byte};
pub use parser::{
    AndThen, AsciiStr, Byte, Map, MapErr, Optional, Or, Peeked, Predicate, Repeat,
    RepetitionArgument,
};
pub use result::{Error, Res};