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
//! See the
//! [README.md](https://gitlab.com/wake-sleeper/parser-compose/-/blob/main/README.md?ref_type=heads)
//! for the introduction and examples
//!
//! ## Parsers
//!
//! Any rust item that implements the [`Parser`] trait can parse input by
//! calling [try_parse()](crate::parser::Parser::try_parse)
//!
//! Strings and slices implement the `Parser` trait:
//! - [`&str`](crate::Parser#parser-implementation-for-string-slices)
//! - [`slice`s](crate::Parser#parser-implementation-for-slices)
//!
//! Additionally the `Parser` trait is implemented for [all functions with the following
//! signature](crate::parser::Parser#parser-implementation-for-functions).
//!
//! Lastly, a few utility parsers are provided:
//!
//! - [`utf8_scalar()`](crate::utf8_scalar)
//! - [`byte()`](crate::byte)
//! - [`first_utf8_scalar()`](crate::first_utf8_scalar)
//! - [`first_slice_item()`](crate::first_slice_item)
//!
//!
//! ## Parser combinators
//!
//! The associated methods on the [`Parser`] trait are used to combine parsers.
//!
//! - [`or()`](crate::Parser::or)
//! - [`when()`](crate::Parser::when)
//! - [`fold()`](crate::Parser::fold)
//! - [`accumulate()`](crate::Parser::accumulate)
//! - [`repeats()`](crate::Parser::repeats)
//! - [`map()`](crate::Parser::map)
//! - [`peek()`](crate::Parser::peek)
//! - [`not()`](crate::Parser::not)
//! - [`input()`](crate::Parser::input)
//! - [`and_then()`](crate::Parser::and_then)
//! - [`optional()`](crate::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>-for-(P0,+P1)) such that the tuple parser succeeds if all its parsers succeed.
//!
//! ## Errors
//!
//! `parser-compose` take a simple approach to error handling: If a parser fails, it returns `None`
//!

mod parser;
pub use parser::Parser;
pub use parser::{byte, first_slice_item, first_utf8_scalar, utf8_scalar};
pub use parser::{
    AccumulateInit, AccumulateOperation, AndThen, Byte, Fold, Map, Optional, Or, Peek, Predicate,
    RepeatsInit, RepeatsOperation, RepetitionArgument, Utf8Scalar,
};