nom_supreme/
lib.rs

1/*!
2A collection of excellent utilities for nom, including:
3
4- [`ParserExt`][parser_ext::ParserExt], a trait which makes available
5  many common nom parser combinators as postfix methods, to complement
6  those already available on [`nom::Parser`].
7- [`ErrorTree`][error::ErrorTree], a nom error which retains as much
8  information and context as possible about the details of the failed
9  parse, with an excellent indenting formatter for printing these failures.
10  Integrates with the extra error features of `nom-supreme`.
11- Improved [`tag`] parsers, which attach the mismatched the error in the
12  event of a parse failure, similar to
13  [`char`][nom::character::complete::char].
14- [`parse_separated_terminated`][multi::parse_separated_terminated], the
15  perfected folding parser for building parse loops.
16- [`final_parser`][final_parser::final_parser], which serves as a bridge
17  between nom-style [`IResult`][nom::IResult] parsers and more typical rust
18  results. It decorates a nom parser, requiring it to parse all of its
19  input, not return `Incomplete`. It also uses an
20  [`ExtractContext`][final_parser::ExtractContext] trait to convert the
21  error locations in nom errors, which are usually just suffixes of the
22  input, into more useful locations, such as a line and column number.
23*/
24
25#![deny(missing_docs)]
26
27/**
28Call a method or methods on an object, and then return the original object.
29
30The input to this macro is the methods calls written in a chaining style:
31`express!(vec.push(1).push(2).push(3))`, which is transformed into a series
32of calls on the original object, then returning that object.
33*/
34macro_rules! express {
35    ($thing:ident $( . $method:ident ( $($args:tt)* ) )*) => {{
36        let mut thing = $thing;
37        $( thing.$method($($args)*); )*
38        thing
39    }};
40}
41
42pub mod context;
43pub mod error;
44pub mod final_parser;
45pub mod multi;
46pub mod parser_ext;
47pub mod tag;
48
49pub use parser_ext::ParserExt;