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 59 60 61 62 63 64 65 66 67
//! 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 three parts
//!
//! ## Parsers
//!
//! Any rust item that implements the [Parser](crate::parser::Parser) trait can parse input by
//! calling [try_parse()](crate::parser::Parser::try_parse)
//!
//! - [`&str`](crate::Parser#impl-Parser<%26'input+str>-for-%26'pat+str)
//! - [`slice`s](crate::Parser#impl-Parser<%26'i+[T]>-for-%26'p+[T])
//! - [`utf8_str`](crate::utf8_str)
//! - [`any_utf8_str`](crate::any_utf8_str)
//! - [`byte`](crate::byte)
//! - [`any_byte`](crate::any_byte)
//! - [`end`](crate::end)
//!
//! Additionally the `Parser` trait is implemented for [all function with a particular signature](crate::parser::Parser#impl-Parser<In>-for-F).
//!
//!
//! ## Parser combinators
//!
//! The associated methods on the [Parser](crate::parser::Parser) trait are used to combine with
//! other parsers.
//!
//! - [`or()`](crate::Parser::or)
//! - [`when()`](crate::Parser::when)
//! - [`fold()`](crate::Parser::fold)
//! - [`accumulate()`](crate::Parser::accumulate)
//! - [`skim()`](crate::Parser::skim)
//! - [`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 but comprehensive approach to error handling: All parsers and
//! combinators report errors by building up an [`ErrorTree`](crate::ErrorTree). If the top level
//! parser fails, the result will contain an instance of this tree.
//!
//!
//!
//! ## Examples
//!
//! Checkout the [integration test
//! directory](https://gitlab.com/wake-sleeper/parser-compose/-/tree/main/tests) for concrete
//! parsing examples.
mod input;
mod parser;
mod result;
pub use input::ParserContext;
pub use parser::Parser;
pub use parser::{any_byte, any_utf8_str, byte, end, utf8_str};
pub use parser::{
AndThen, Byte, Fold, Map, Optional, Or, Peek, Predicate, RepetitionArgument, Utf8Str,
};
pub use result::{ErrorTree, Res};