/rust/registry/src/index.crates.io-1949cf8c6b5b557f/nom-7.1.3/src/branch/mod.rs
Line | Count | Source |
1 | | //! Choice combinators |
2 | | |
3 | | #[cfg(test)] |
4 | | mod tests; |
5 | | |
6 | | use crate::error::ErrorKind; |
7 | | use crate::error::ParseError; |
8 | | use crate::internal::{Err, IResult, Parser}; |
9 | | |
10 | | /// Helper trait for the [alt()] combinator. |
11 | | /// |
12 | | /// This trait is implemented for tuples of up to 21 elements |
13 | | pub trait Alt<I, O, E> { |
14 | | /// Tests each parser in the tuple and returns the result of the first one that succeeds |
15 | | fn choice(&mut self, input: I) -> IResult<I, O, E>; |
16 | | } |
17 | | |
18 | | /// Tests a list of parsers one by one until one succeeds. |
19 | | /// |
20 | | /// It takes as argument a tuple of parsers. There is a maximum of 21 |
21 | | /// parsers. If you need more, it is possible to nest them in other `alt` calls, |
22 | | /// like this: `alt(parser_a, alt(parser_b, parser_c))` |
23 | | /// |
24 | | /// ```rust |
25 | | /// # use nom::error_position; |
26 | | /// # use nom::{Err,error::ErrorKind, Needed, IResult}; |
27 | | /// use nom::character::complete::{alpha1, digit1}; |
28 | | /// use nom::branch::alt; |
29 | | /// # fn main() { |
30 | | /// fn parser(input: &str) -> IResult<&str, &str> { |
31 | | /// alt((alpha1, digit1))(input) |
32 | | /// }; |
33 | | /// |
34 | | /// // the first parser, alpha1, recognizes the input |
35 | | /// assert_eq!(parser("abc"), Ok(("", "abc"))); |
36 | | /// |
37 | | /// // the first parser returns an error, so alt tries the second one |
38 | | /// assert_eq!(parser("123456"), Ok(("", "123456"))); |
39 | | /// |
40 | | /// // both parsers failed, and with the default error type, alt will return the last error |
41 | | /// assert_eq!(parser(" "), Err(Err::Error(error_position!(" ", ErrorKind::Digit)))); |
42 | | /// # } |
43 | | /// ``` |
44 | | /// |
45 | | /// With a custom error type, it is possible to have alt return the error of the parser |
46 | | /// that went the farthest in the input data |
47 | 203M | pub fn alt<I: Clone, O, E: ParseError<I>, List: Alt<I, O, E>>( |
48 | 203M | mut l: List, |
49 | 203M | ) -> impl FnMut(I) -> IResult<I, O, E> { |
50 | 106M | move |i: I| l.choice(i) nom::branch::alt::<(&[u8], usize), u8, nom::error::Error<(&[u8], usize)>, (suricata::http2::huffman::http2_decode_huffman_len5, suricata::http2::huffman::http2_decode_huffman_len6, suricata::http2::huffman::http2_decode_huffman_len7, suricata::http2::huffman::http2_decode_huffman_len8, suricata::http2::huffman::http2_decode_huffman_len10, suricata::http2::huffman::http2_decode_huffman_len11, suricata::http2::huffman::http2_decode_huffman_len12, suricata::http2::huffman::http2_decode_huffman_len13, suricata::http2::huffman::http2_decode_huffman_len14, suricata::http2::huffman::http2_decode_huffman_len15, suricata::http2::huffman::http2_decode_huffman_len19, suricata::http2::huffman::http2_decode_huffman_len20, suricata::http2::huffman::http2_decode_huffman_len21, suricata::http2::huffman::http2_decode_huffman_len21, suricata::http2::huffman::http2_decode_huffman_len22, suricata::http2::huffman::http2_decode_huffman_len23, suricata::http2::huffman::http2_decode_huffman_len24, suricata::http2::huffman::http2_decode_huffman_len25, suricata::http2::huffman::http2_decode_huffman_len26, suricata::http2::huffman::http2_decode_huffman_len27, nom::branch::alt<(&[u8], usize), u8, nom::error::Error<(&[u8], usize)>, (suricata::http2::huffman::http2_decode_huffman_len28, suricata::http2::huffman::http2_decode_huffman_len30, suricata::http2::huffman::http2_decode_huffman_end)>::{closure#0})>::{closure#0}Line | Count | Source | 50 | 52.9M | move |i: I| l.choice(i) |
nom::branch::alt::<&[u8], suricata::http2::range::HTTPContentRange, nom::error::Error<&[u8]>, (suricata::http2::range::http2_parse_content_range_star, suricata::http2::range::http2_parse_content_range_def)>::{closure#0}Line | Count | Source | 50 | 77.8k | move |i: I| l.choice(i) |
nom::branch::alt::<&[u8], i64, nom::error::Error<&[u8]>, (nom::combinator::value<&[u8], i64, char, nom::error::Error<&[u8]>, nom::character::complete::char<&[u8], nom::error::Error<&[u8]>>::{closure#0}>::{closure#0}, nom::combinator::map_res<&[u8], &str, i64, nom::error::Error<&[u8]>, core::num::error::ParseIntError, nom::combinator::map_res<&[u8], &[u8], &str, nom::error::Error<&[u8]>, core::str::error::Utf8Error, nom::character::complete::digit1<&[u8], nom::error::Error<&[u8]>>, core::str::converts::from_utf8>::{closure#0}, <i64 as core::str::traits::FromStr>::from_str>::{closure#0})>::{closure#0}Line | Count | Source | 50 | 66.5k | move |i: I| l.choice(i) |
nom::branch::alt::<(&[u8], usize), u8, nom::error::Error<(&[u8], usize)>, (suricata::http2::huffman::http2_decode_huffman_len28, suricata::http2::huffman::http2_decode_huffman_len30, suricata::http2::huffman::http2_decode_huffman_end)>::{closure#0}Line | Count | Source | 50 | 1.59M | move |i: I| l.choice(i) |
nom::branch::alt::<&[u8], asn1_rs::asn1_types::any::Any, asn1_rs::error::Error, (<asn1_rs::asn1_types::any::Any as asn1_rs::traits::FromDer>::from_der, x509_parser::x509::parse_malformed_string)>::{closure#0}Line | Count | Source | 50 | 29.0k | move |i: I| l.choice(i) |
Unexecuted instantiation: nom::branch::alt::<&[u8], der_parser::ber::ber::BerObject, asn1_rs::error::Error, (der_parser::der::parser::parse_der_utf8string, der_parser::der::parser::parse_der_printablestring, der_parser::der::parser::parse_der_universalstring, der_parser::der::parser::parse_der_bmpstring, der_parser::der::parser::parse_der_t61string)>::{closure#0}nom::branch::alt::<&[u8], tls_parser::tls::TlsMessageHandshake, nom::error::Error<&[u8]>, (nom::combinator::complete<&[u8], tls_parser::tls::TlsMessageHandshake, nom::error::Error<&[u8]>, tls_parser::tls::parse_certrequest_full>::{closure#0}, nom::combinator::complete<&[u8], tls_parser::tls::TlsMessageHandshake, nom::error::Error<&[u8]>, tls_parser::tls::parse_certrequest_nosigalg>::{closure#0})>::{closure#0}Line | Count | Source | 50 | 91.0k | move |i: I| l.choice(i) |
Unexecuted instantiation: nom::branch::alt::<_, _, _, _>::{closure#0}nom::branch::alt::<&[u8], suricata::http2::range::HTTPContentRange, nom::error::Error<&[u8]>, (suricata::http2::range::http2_parse_content_range_star, suricata::http2::range::http2_parse_content_range_def)>::{closure#0}Line | Count | Source | 50 | 17.5k | move |i: I| l.choice(i) |
nom::branch::alt::<&[u8], i64, nom::error::Error<&[u8]>, (nom::combinator::value<&[u8], i64, char, nom::error::Error<&[u8]>, nom::character::complete::char<&[u8], nom::error::Error<&[u8]>>::{closure#0}>::{closure#0}, nom::combinator::map_res<&[u8], &str, i64, nom::error::Error<&[u8]>, core::num::error::ParseIntError, nom::combinator::map_res<&[u8], &[u8], &str, nom::error::Error<&[u8]>, core::str::error::Utf8Error, nom::character::complete::digit1<&[u8], nom::error::Error<&[u8]>>, core::str::converts::from_utf8>::{closure#0}, <i64 as core::str::traits::FromStr>::from_str>::{closure#0})>::{closure#0}Line | Count | Source | 50 | 13.3k | move |i: I| l.choice(i) |
nom::branch::alt::<&str, bool, nom::error::Error<&str>, (nom::combinator::value<&str, bool, &str, nom::error::Error<&str>, nom::bytes::complete::tag<&str, &str, nom::error::Error<&str>>::{closure#0}>::{closure#0}, nom::combinator::value<&str, bool, &str, nom::error::Error<&str>, nom::bytes::complete::tag<&str, &str, nom::error::Error<&str>>::{closure#0}>::{closure#0})>::{closure#0}Line | Count | Source | 50 | 435 | move |i: I| l.choice(i) |
nom::branch::alt::<(&[u8], usize), u8, nom::error::Error<(&[u8], usize)>, (suricata::http2::huffman::http2_decode_huffman_len5, suricata::http2::huffman::http2_decode_huffman_len6, suricata::http2::huffman::http2_decode_huffman_len7, suricata::http2::huffman::http2_decode_huffman_len8, suricata::http2::huffman::http2_decode_huffman_len10, suricata::http2::huffman::http2_decode_huffman_len11, suricata::http2::huffman::http2_decode_huffman_len12, suricata::http2::huffman::http2_decode_huffman_len13, suricata::http2::huffman::http2_decode_huffman_len14, suricata::http2::huffman::http2_decode_huffman_len15, suricata::http2::huffman::http2_decode_huffman_len19, suricata::http2::huffman::http2_decode_huffman_len20, suricata::http2::huffman::http2_decode_huffman_len21, suricata::http2::huffman::http2_decode_huffman_len21, suricata::http2::huffman::http2_decode_huffman_len22, suricata::http2::huffman::http2_decode_huffman_len23, suricata::http2::huffman::http2_decode_huffman_len24, suricata::http2::huffman::http2_decode_huffman_len25, suricata::http2::huffman::http2_decode_huffman_len26, suricata::http2::huffman::http2_decode_huffman_len27, nom::branch::alt<(&[u8], usize), u8, nom::error::Error<(&[u8], usize)>, (suricata::http2::huffman::http2_decode_huffman_len28, suricata::http2::huffman::http2_decode_huffman_len30, suricata::http2::huffman::http2_decode_huffman_end)>::{closure#0})>::{closure#0}Line | Count | Source | 50 | 46.3M | move |i: I| l.choice(i) |
nom::branch::alt::<&str, &str, nom::error::Error<&str>, (nom::bytes::complete::tag<&str, &str, nom::error::Error<&str>>::{closure#0}, nom::bytes::complete::tag<&str, &str, nom::error::Error<&str>>::{closure#0})>::{closure#0}Line | Count | Source | 50 | 35.0k | move |i: I| l.choice(i) |
nom::branch::alt::<&str, suricata::detect::uint::DetectUintData<u8>, nom::error::Error<&str>, (suricata::detect::uint::detect_parse_uint_start_interval<u8>, suricata::detect::uint::detect_parse_uint_start_equal<u8>, suricata::detect::uint::detect_parse_uint_start_symbol<u8>)>::{closure#0}Line | Count | Source | 50 | 17.6k | move |i: I| l.choice(i) |
nom::branch::alt::<&str, suricata::detect::uint::DetectUintData<u32>, nom::error::Error<&str>, (suricata::detect::uint::detect_parse_uint_start_interval<u32>, suricata::detect::uint::detect_parse_uint_start_equal<u32>, suricata::detect::uint::detect_parse_uint_start_symbol<u32>)>::{closure#0}Line | Count | Source | 50 | 7.67k | move |i: I| l.choice(i) |
nom::branch::alt::<&str, suricata::detect::uint::DetectUintData<u32>, nom::error::Error<&str>, (suricata::detect::uint::detect_parse_uint_start_interval_inclusive<u32>, suricata::detect::uint::detect_parse_uint_start_equal<u32>, suricata::detect::uint::detect_parse_uint_start_symbol<u32>)>::{closure#0}Line | Count | Source | 50 | 4.16k | move |i: I| l.choice(i) |
nom::branch::alt::<&str, suricata::detect::uint::DetectUintData<u16>, nom::error::Error<&str>, (suricata::detect::uint::detect_parse_uint_start_interval<u16>, suricata::detect::uint::detect_parse_uint_start_equal<u16>, suricata::detect::uint::detect_parse_uint_start_symbol<u16>)>::{closure#0}Line | Count | Source | 50 | 18.8k | move |i: I| l.choice(i) |
nom::branch::alt::<&str, suricata::detect::uint::DetectUintData<u64>, nom::error::Error<&str>, (suricata::detect::uint::detect_parse_uint_start_interval<u64>, suricata::detect::uint::detect_parse_uint_start_equal<u64>, suricata::detect::uint::detect_parse_uint_start_symbol<u64>)>::{closure#0}Line | Count | Source | 50 | 14.0k | move |i: I| l.choice(i) |
nom::branch::alt::<&str, suricata::detect::uint::DetectUintMode, nom::error::Error<&str>, (nom::combinator::value<&str, suricata::detect::uint::DetectUintMode, &str, nom::error::Error<&str>, nom::bytes::complete::tag<&str, &str, nom::error::Error<&str>>::{closure#0}>::{closure#0}, nom::combinator::value<&str, suricata::detect::uint::DetectUintMode, &str, nom::error::Error<&str>, nom::bytes::complete::tag<&str, &str, nom::error::Error<&str>>::{closure#0}>::{closure#0}, nom::combinator::value<&str, suricata::detect::uint::DetectUintMode, &str, nom::error::Error<&str>, nom::bytes::complete::tag<&str, &str, nom::error::Error<&str>>::{closure#0}>::{closure#0}, nom::combinator::value<&str, suricata::detect::uint::DetectUintMode, &str, nom::error::Error<&str>, nom::bytes::complete::tag<&str, &str, nom::error::Error<&str>>::{closure#0}>::{closure#0}, nom::combinator::value<&str, suricata::detect::uint::DetectUintMode, &str, nom::error::Error<&str>, nom::bytes::complete::tag<&str, &str, nom::error::Error<&str>>::{closure#0}>::{closure#0}, nom::combinator::value<&str, suricata::detect::uint::DetectUintMode, &str, nom::error::Error<&str>, nom::bytes::complete::tag<&str, &str, nom::error::Error<&str>>::{closure#0}>::{closure#0}, nom::combinator::value<&str, suricata::detect::uint::DetectUintMode, &str, nom::error::Error<&str>, nom::bytes::complete::tag<&str, &str, nom::error::Error<&str>>::{closure#0}>::{closure#0})>::{closure#0}Line | Count | Source | 50 | 27.0k | move |i: I| l.choice(i) |
nom::branch::alt::<&str, u64, nom::error::Error<&str>, (nom::combinator::value<&str, u64, &str, nom::error::Error<&str>, nom::bytes::complete::tag_no_case<&str, &str, nom::error::Error<&str>>::{closure#0}>::{closure#0}, nom::combinator::value<&str, u64, &str, nom::error::Error<&str>, nom::bytes::complete::tag_no_case<&str, &str, nom::error::Error<&str>>::{closure#0}>::{closure#0}, nom::combinator::value<&str, u64, &str, nom::error::Error<&str>, nom::bytes::complete::tag_no_case<&str, &str, nom::error::Error<&str>>::{closure#0}>::{closure#0})>::{closure#0}Line | Count | Source | 50 | 32.5k | move |i: I| l.choice(i) |
nom::branch::alt::<&[u8], &[u8], nom::error::Error<&[u8]>, (nom::combinator::complete<&[u8], &[u8], nom::error::Error<&[u8]>, nom::bytes::streaming::is_not<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}>::{closure#0}, nom::combinator::rest<&[u8], nom::error::Error<&[u8]>>)>::{closure#0}Line | Count | Source | 50 | 3.24k | move |i: I| l.choice(i) |
nom::branch::alt::<&[u8], &[u8], nom::error::Error<&[u8]>, (nom::bytes::streaming::tag<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::bytes::streaming::tag<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::bytes::streaming::tag<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::bytes::streaming::tag<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::bytes::streaming::tag<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0})>::{closure#0}Line | Count | Source | 50 | 4.62k | move |i: I| l.choice(i) |
nom::branch::alt::<&[u8], &[u8], nom::error::Error<&[u8]>, (nom::bytes::streaming::tag<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::bytes::streaming::tag<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::bytes::streaming::tag<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0})>::{closure#0}Line | Count | Source | 50 | 5.96k | move |i: I| l.choice(i) |
nom::branch::alt::<&[u8], char, nom::error::Error<&[u8]>, (nom::character::streaming::char<&[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::character::streaming::char<&[u8], nom::error::Error<&[u8]>>::{closure#0})>::{closure#0}Line | Count | Source | 50 | 174k | move |i: I| l.choice(i) |
nom::branch::alt::<&[u8], &[u8], nom::error::Error<&[u8]>, (suricata::mime::mime_parse_value_delimited, nom::combinator::complete<&[u8], &[u8], nom::error::Error<&[u8]>, nom::bytes::streaming::take_until<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}>::{closure#0}, nom::combinator::rest<&[u8], nom::error::Error<&[u8]>>)>::{closure#0}Line | Count | Source | 50 | 4.57M | move |i: I| l.choice(i) |
nom::branch::alt::<&[u8], &[u8], nom::error::Error<&[u8]>, (nom::bytes::streaming::tag<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::bytes::streaming::tag<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}, suricata::ssh::parser::ssh_parse_line::parser)>::{closure#0}Line | Count | Source | 50 | 22.7k | move |i: I| l.choice(i) |
nom::branch::alt::<&str, &str, nom::error::Error<&str>, (nom::character::complete::multispace1<&str, nom::error::Error<&str>>, nom::bytes::complete::tag<&str, &str, nom::error::Error<&str>>::{closure#0})>::{closure#0}Line | Count | Source | 50 | 3.93k | move |i: I| l.choice(i) |
nom::branch::alt::<&str, &str, nom::error::Error<&str>, (nom::combinator::complete<&str, &str, nom::error::Error<&str>, nom::bytes::streaming::is_not<&str, &str, nom::error::Error<&str>>::{closure#0}>::{closure#0}, nom::combinator::rest<&str, nom::error::Error<&str>>)>::{closure#0}Line | Count | Source | 50 | 2.59k | move |i: I| l.choice(i) |
Unexecuted instantiation: nom::branch::alt::<&str, &str, nom::error::Error<&str>, (nom::number::complete::recognize_float_or_exceptions<&str, nom::error::Error<&str>>::{closure#0}, nom::number::complete::recognize_float_or_exceptions<&str, nom::error::Error<&str>>::{closure#1}, nom::number::complete::recognize_float_or_exceptions<&str, nom::error::Error<&str>>::{closure#2}, nom::number::complete::recognize_float_or_exceptions<&str, nom::error::Error<&str>>::{closure#3})>::{closure#0}nom::branch::alt::<&str, suricata::krb::detect::DetectKrb5TicketEncryptionData, nom::error::Error<&str>, (suricata::krb::detect::detect_parse_encryption_weak, suricata::krb::detect::detect_parse_encryption_list)>::{closure#0}Line | Count | Source | 50 | 1.27k | move |i: I| l.choice(i) |
nom::branch::alt::<&str, suricata::detect::requires::VersionCompareOp, nom::error::Error<&str>, (nom::combinator::map<&str, &str, suricata::detect::requires::VersionCompareOp, nom::error::Error<&str>, nom::bytes::complete::tag<&str, &str, nom::error::Error<&str>>::{closure#0}, suricata::detect::requires::parse_op::{closure#0}>::{closure#0}, nom::combinator::map<&str, &str, suricata::detect::requires::VersionCompareOp, nom::error::Error<&str>, nom::bytes::complete::tag<&str, &str, nom::error::Error<&str>>::{closure#0}, suricata::detect::requires::parse_op::{closure#1}>::{closure#0}, nom::combinator::map<&str, &str, suricata::detect::requires::VersionCompareOp, nom::error::Error<&str>, nom::bytes::complete::tag<&str, &str, nom::error::Error<&str>>::{closure#0}, suricata::detect::requires::parse_op::{closure#2}>::{closure#0}, nom::combinator::map<&str, &str, suricata::detect::requires::VersionCompareOp, nom::error::Error<&str>, nom::bytes::complete::tag<&str, &str, nom::error::Error<&str>>::{closure#0}, suricata::detect::requires::parse_op::{closure#3}>::{closure#0})>::{closure#0}Line | Count | Source | 50 | 40.7k | move |i: I| l.choice(i) |
Unexecuted instantiation: nom::branch::alt::<&str, char, nom::error::Error<&str>, (nom::character::complete::char<&str, nom::error::Error<&str>>::{closure#0}, nom::character::complete::char<&str, nom::error::Error<&str>>::{closure#0})>::{closure#0}Unexecuted instantiation: nom::branch::alt::<&str, (), nom::error::Error<&str>, (nom::combinator::map<&str, (&str, core::option::Option<(char, core::option::Option<&str>)>), (), nom::error::Error<&str>, nom::sequence::tuple<&str, (&str, core::option::Option<(char, core::option::Option<&str>)>), nom::error::Error<&str>, (nom::character::complete::digit1<&str, nom::error::Error<&str>>, nom::combinator::opt<&str, (char, core::option::Option<&str>), nom::error::Error<&str>, nom::sequence::pair<&str, char, core::option::Option<&str>, nom::error::Error<&str>, nom::character::complete::char<&str, nom::error::Error<&str>>::{closure#0}, nom::combinator::opt<&str, &str, nom::error::Error<&str>, nom::character::complete::digit1<&str, nom::error::Error<&str>>>::{closure#0}>::{closure#0}>::{closure#0})>::{closure#0}, nom::number::complete::recognize_float<&str, nom::error::Error<&str>>::{closure#0}>::{closure#0}, nom::combinator::map<&str, (char, &str), (), nom::error::Error<&str>, nom::sequence::tuple<&str, (char, &str), nom::error::Error<&str>, (nom::character::complete::char<&str, nom::error::Error<&str>>::{closure#0}, nom::character::complete::digit1<&str, nom::error::Error<&str>>)>::{closure#0}, nom::number::complete::recognize_float<&str, nom::error::Error<&str>>::{closure#1}>::{closure#0})>::{closure#0}nom::branch::alt::<(&[u8], usize), u8, nom::error::Error<(&[u8], usize)>, (suricata::http2::huffman::http2_decode_huffman_len28, suricata::http2::huffman::http2_decode_huffman_len30, suricata::http2::huffman::http2_decode_huffman_end)>::{closure#0}Line | Count | Source | 50 | 569k | move |i: I| l.choice(i) |
nom::branch::alt::<&[u8], asn1_rs::asn1_types::any::Any, asn1_rs::error::Error, (<asn1_rs::asn1_types::any::Any as asn1_rs::traits::FromDer>::from_der, x509_parser::x509::parse_malformed_string)>::{closure#0}Line | Count | Source | 50 | 21.9k | move |i: I| l.choice(i) |
Unexecuted instantiation: nom::branch::alt::<&[u8], der_parser::ber::ber::BerObject, asn1_rs::error::Error, (der_parser::der::parser::parse_der_utf8string, der_parser::der::parser::parse_der_printablestring, der_parser::der::parser::parse_der_universalstring, der_parser::der::parser::parse_der_bmpstring, der_parser::der::parser::parse_der_t61string)>::{closure#0}nom::branch::alt::<&[u8], tls_parser::tls::TlsMessageHandshake, nom::error::Error<&[u8]>, (nom::combinator::complete<&[u8], tls_parser::tls::TlsMessageHandshake, nom::error::Error<&[u8]>, tls_parser::tls::parse_certrequest_full>::{closure#0}, nom::combinator::complete<&[u8], tls_parser::tls::TlsMessageHandshake, nom::error::Error<&[u8]>, tls_parser::tls::parse_certrequest_nosigalg>::{closure#0})>::{closure#0}Line | Count | Source | 50 | 8.89k | move |i: I| l.choice(i) |
Unexecuted instantiation: nom::branch::alt::<_, _, _, _>::{closure#0} |
51 | 203M | } nom::branch::alt::<(&[u8], usize), u8, nom::error::Error<(&[u8], usize)>, (suricata::http2::huffman::http2_decode_huffman_len5, suricata::http2::huffman::http2_decode_huffman_len6, suricata::http2::huffman::http2_decode_huffman_len7, suricata::http2::huffman::http2_decode_huffman_len8, suricata::http2::huffman::http2_decode_huffman_len10, suricata::http2::huffman::http2_decode_huffman_len11, suricata::http2::huffman::http2_decode_huffman_len12, suricata::http2::huffman::http2_decode_huffman_len13, suricata::http2::huffman::http2_decode_huffman_len14, suricata::http2::huffman::http2_decode_huffman_len15, suricata::http2::huffman::http2_decode_huffman_len19, suricata::http2::huffman::http2_decode_huffman_len20, suricata::http2::huffman::http2_decode_huffman_len21, suricata::http2::huffman::http2_decode_huffman_len21, suricata::http2::huffman::http2_decode_huffman_len22, suricata::http2::huffman::http2_decode_huffman_len23, suricata::http2::huffman::http2_decode_huffman_len24, suricata::http2::huffman::http2_decode_huffman_len25, suricata::http2::huffman::http2_decode_huffman_len26, suricata::http2::huffman::http2_decode_huffman_len27, nom::branch::alt<(&[u8], usize), u8, nom::error::Error<(&[u8], usize)>, (suricata::http2::huffman::http2_decode_huffman_len28, suricata::http2::huffman::http2_decode_huffman_len30, suricata::http2::huffman::http2_decode_huffman_end)>::{closure#0})>Line | Count | Source | 47 | 52.9M | pub fn alt<I: Clone, O, E: ParseError<I>, List: Alt<I, O, E>>( | 48 | 52.9M | mut l: List, | 49 | 52.9M | ) -> impl FnMut(I) -> IResult<I, O, E> { | 50 | | move |i: I| l.choice(i) | 51 | 52.9M | } |
nom::branch::alt::<(&[u8], usize), u8, nom::error::Error<(&[u8], usize)>, (suricata::http2::huffman::http2_decode_huffman_len28, suricata::http2::huffman::http2_decode_huffman_len30, suricata::http2::huffman::http2_decode_huffman_end)> Line | Count | Source | 47 | 52.9M | pub fn alt<I: Clone, O, E: ParseError<I>, List: Alt<I, O, E>>( | 48 | 52.9M | mut l: List, | 49 | 52.9M | ) -> impl FnMut(I) -> IResult<I, O, E> { | 50 | | move |i: I| l.choice(i) | 51 | 52.9M | } |
nom::branch::alt::<&[u8], suricata::http2::range::HTTPContentRange, nom::error::Error<&[u8]>, (suricata::http2::range::http2_parse_content_range_star, suricata::http2::range::http2_parse_content_range_def)> Line | Count | Source | 47 | 77.8k | pub fn alt<I: Clone, O, E: ParseError<I>, List: Alt<I, O, E>>( | 48 | 77.8k | mut l: List, | 49 | 77.8k | ) -> impl FnMut(I) -> IResult<I, O, E> { | 50 | | move |i: I| l.choice(i) | 51 | 77.8k | } |
nom::branch::alt::<&[u8], i64, nom::error::Error<&[u8]>, (nom::combinator::value<&[u8], i64, char, nom::error::Error<&[u8]>, nom::character::complete::char<&[u8], nom::error::Error<&[u8]>>::{closure#0}>::{closure#0}, nom::combinator::map_res<&[u8], &str, i64, nom::error::Error<&[u8]>, core::num::error::ParseIntError, nom::combinator::map_res<&[u8], &[u8], &str, nom::error::Error<&[u8]>, core::str::error::Utf8Error, nom::character::complete::digit1<&[u8], nom::error::Error<&[u8]>>, core::str::converts::from_utf8>::{closure#0}, <i64 as core::str::traits::FromStr>::from_str>::{closure#0})>Line | Count | Source | 47 | 66.5k | pub fn alt<I: Clone, O, E: ParseError<I>, List: Alt<I, O, E>>( | 48 | 66.5k | mut l: List, | 49 | 66.5k | ) -> impl FnMut(I) -> IResult<I, O, E> { | 50 | | move |i: I| l.choice(i) | 51 | 66.5k | } |
nom::branch::alt::<&[u8], asn1_rs::asn1_types::any::Any, asn1_rs::error::Error, (<asn1_rs::asn1_types::any::Any as asn1_rs::traits::FromDer>::from_der, x509_parser::x509::parse_malformed_string)> Line | Count | Source | 47 | 29.0k | pub fn alt<I: Clone, O, E: ParseError<I>, List: Alt<I, O, E>>( | 48 | 29.0k | mut l: List, | 49 | 29.0k | ) -> impl FnMut(I) -> IResult<I, O, E> { | 50 | | move |i: I| l.choice(i) | 51 | 29.0k | } |
Unexecuted instantiation: nom::branch::alt::<&[u8], der_parser::ber::ber::BerObject, asn1_rs::error::Error, (der_parser::der::parser::parse_der_utf8string, der_parser::der::parser::parse_der_printablestring, der_parser::der::parser::parse_der_universalstring, der_parser::der::parser::parse_der_bmpstring, der_parser::der::parser::parse_der_t61string)> nom::branch::alt::<&[u8], tls_parser::tls::TlsMessageHandshake, nom::error::Error<&[u8]>, (nom::combinator::complete<&[u8], tls_parser::tls::TlsMessageHandshake, nom::error::Error<&[u8]>, tls_parser::tls::parse_certrequest_full>::{closure#0}, nom::combinator::complete<&[u8], tls_parser::tls::TlsMessageHandshake, nom::error::Error<&[u8]>, tls_parser::tls::parse_certrequest_nosigalg>::{closure#0})>Line | Count | Source | 47 | 91.0k | pub fn alt<I: Clone, O, E: ParseError<I>, List: Alt<I, O, E>>( | 48 | 91.0k | mut l: List, | 49 | 91.0k | ) -> impl FnMut(I) -> IResult<I, O, E> { | 50 | | move |i: I| l.choice(i) | 51 | 91.0k | } |
Unexecuted instantiation: nom::branch::alt::<_, _, _, _> nom::branch::alt::<&[u8], suricata::http2::range::HTTPContentRange, nom::error::Error<&[u8]>, (suricata::http2::range::http2_parse_content_range_star, suricata::http2::range::http2_parse_content_range_def)> Line | Count | Source | 47 | 17.5k | pub fn alt<I: Clone, O, E: ParseError<I>, List: Alt<I, O, E>>( | 48 | 17.5k | mut l: List, | 49 | 17.5k | ) -> impl FnMut(I) -> IResult<I, O, E> { | 50 | | move |i: I| l.choice(i) | 51 | 17.5k | } |
nom::branch::alt::<&[u8], i64, nom::error::Error<&[u8]>, (nom::combinator::value<&[u8], i64, char, nom::error::Error<&[u8]>, nom::character::complete::char<&[u8], nom::error::Error<&[u8]>>::{closure#0}>::{closure#0}, nom::combinator::map_res<&[u8], &str, i64, nom::error::Error<&[u8]>, core::num::error::ParseIntError, nom::combinator::map_res<&[u8], &[u8], &str, nom::error::Error<&[u8]>, core::str::error::Utf8Error, nom::character::complete::digit1<&[u8], nom::error::Error<&[u8]>>, core::str::converts::from_utf8>::{closure#0}, <i64 as core::str::traits::FromStr>::from_str>::{closure#0})>Line | Count | Source | 47 | 13.3k | pub fn alt<I: Clone, O, E: ParseError<I>, List: Alt<I, O, E>>( | 48 | 13.3k | mut l: List, | 49 | 13.3k | ) -> impl FnMut(I) -> IResult<I, O, E> { | 50 | | move |i: I| l.choice(i) | 51 | 13.3k | } |
nom::branch::alt::<&str, bool, nom::error::Error<&str>, (nom::combinator::value<&str, bool, &str, nom::error::Error<&str>, nom::bytes::complete::tag<&str, &str, nom::error::Error<&str>>::{closure#0}>::{closure#0}, nom::combinator::value<&str, bool, &str, nom::error::Error<&str>, nom::bytes::complete::tag<&str, &str, nom::error::Error<&str>>::{closure#0}>::{closure#0})>Line | Count | Source | 47 | 435 | pub fn alt<I: Clone, O, E: ParseError<I>, List: Alt<I, O, E>>( | 48 | 435 | mut l: List, | 49 | 435 | ) -> impl FnMut(I) -> IResult<I, O, E> { | 50 | | move |i: I| l.choice(i) | 51 | 435 | } |
nom::branch::alt::<(&[u8], usize), u8, nom::error::Error<(&[u8], usize)>, (suricata::http2::huffman::http2_decode_huffman_len5, suricata::http2::huffman::http2_decode_huffman_len6, suricata::http2::huffman::http2_decode_huffman_len7, suricata::http2::huffman::http2_decode_huffman_len8, suricata::http2::huffman::http2_decode_huffman_len10, suricata::http2::huffman::http2_decode_huffman_len11, suricata::http2::huffman::http2_decode_huffman_len12, suricata::http2::huffman::http2_decode_huffman_len13, suricata::http2::huffman::http2_decode_huffman_len14, suricata::http2::huffman::http2_decode_huffman_len15, suricata::http2::huffman::http2_decode_huffman_len19, suricata::http2::huffman::http2_decode_huffman_len20, suricata::http2::huffman::http2_decode_huffman_len21, suricata::http2::huffman::http2_decode_huffman_len21, suricata::http2::huffman::http2_decode_huffman_len22, suricata::http2::huffman::http2_decode_huffman_len23, suricata::http2::huffman::http2_decode_huffman_len24, suricata::http2::huffman::http2_decode_huffman_len25, suricata::http2::huffman::http2_decode_huffman_len26, suricata::http2::huffman::http2_decode_huffman_len27, nom::branch::alt<(&[u8], usize), u8, nom::error::Error<(&[u8], usize)>, (suricata::http2::huffman::http2_decode_huffman_len28, suricata::http2::huffman::http2_decode_huffman_len30, suricata::http2::huffman::http2_decode_huffman_end)>::{closure#0})>Line | Count | Source | 47 | 46.3M | pub fn alt<I: Clone, O, E: ParseError<I>, List: Alt<I, O, E>>( | 48 | 46.3M | mut l: List, | 49 | 46.3M | ) -> impl FnMut(I) -> IResult<I, O, E> { | 50 | | move |i: I| l.choice(i) | 51 | 46.3M | } |
nom::branch::alt::<(&[u8], usize), u8, nom::error::Error<(&[u8], usize)>, (suricata::http2::huffman::http2_decode_huffman_len28, suricata::http2::huffman::http2_decode_huffman_len30, suricata::http2::huffman::http2_decode_huffman_end)> Line | Count | Source | 47 | 46.3M | pub fn alt<I: Clone, O, E: ParseError<I>, List: Alt<I, O, E>>( | 48 | 46.3M | mut l: List, | 49 | 46.3M | ) -> impl FnMut(I) -> IResult<I, O, E> { | 50 | | move |i: I| l.choice(i) | 51 | 46.3M | } |
nom::branch::alt::<&str, &str, nom::error::Error<&str>, (nom::character::complete::multispace1<&str, nom::error::Error<&str>>, nom::bytes::complete::tag<&str, &str, nom::error::Error<&str>>::{closure#0})>Line | Count | Source | 47 | 3.93k | pub fn alt<I: Clone, O, E: ParseError<I>, List: Alt<I, O, E>>( | 48 | 3.93k | mut l: List, | 49 | 3.93k | ) -> impl FnMut(I) -> IResult<I, O, E> { | 50 | | move |i: I| l.choice(i) | 51 | 3.93k | } |
nom::branch::alt::<&str, &str, nom::error::Error<&str>, (nom::bytes::complete::tag<&str, &str, nom::error::Error<&str>>::{closure#0}, nom::bytes::complete::tag<&str, &str, nom::error::Error<&str>>::{closure#0})>Line | Count | Source | 47 | 35.0k | pub fn alt<I: Clone, O, E: ParseError<I>, List: Alt<I, O, E>>( | 48 | 35.0k | mut l: List, | 49 | 35.0k | ) -> impl FnMut(I) -> IResult<I, O, E> { | 50 | | move |i: I| l.choice(i) | 51 | 35.0k | } |
nom::branch::alt::<&str, suricata::detect::uint::DetectUintData<u8>, nom::error::Error<&str>, (suricata::detect::uint::detect_parse_uint_start_interval<u8>, suricata::detect::uint::detect_parse_uint_start_equal<u8>, suricata::detect::uint::detect_parse_uint_start_symbol<u8>)> Line | Count | Source | 47 | 17.6k | pub fn alt<I: Clone, O, E: ParseError<I>, List: Alt<I, O, E>>( | 48 | 17.6k | mut l: List, | 49 | 17.6k | ) -> impl FnMut(I) -> IResult<I, O, E> { | 50 | | move |i: I| l.choice(i) | 51 | 17.6k | } |
nom::branch::alt::<&str, suricata::detect::uint::DetectUintData<u32>, nom::error::Error<&str>, (suricata::detect::uint::detect_parse_uint_start_interval<u32>, suricata::detect::uint::detect_parse_uint_start_equal<u32>, suricata::detect::uint::detect_parse_uint_start_symbol<u32>)> Line | Count | Source | 47 | 7.67k | pub fn alt<I: Clone, O, E: ParseError<I>, List: Alt<I, O, E>>( | 48 | 7.67k | mut l: List, | 49 | 7.67k | ) -> impl FnMut(I) -> IResult<I, O, E> { | 50 | | move |i: I| l.choice(i) | 51 | 7.67k | } |
nom::branch::alt::<&str, suricata::detect::uint::DetectUintData<u32>, nom::error::Error<&str>, (suricata::detect::uint::detect_parse_uint_start_interval_inclusive<u32>, suricata::detect::uint::detect_parse_uint_start_equal<u32>, suricata::detect::uint::detect_parse_uint_start_symbol<u32>)> Line | Count | Source | 47 | 4.16k | pub fn alt<I: Clone, O, E: ParseError<I>, List: Alt<I, O, E>>( | 48 | 4.16k | mut l: List, | 49 | 4.16k | ) -> impl FnMut(I) -> IResult<I, O, E> { | 50 | | move |i: I| l.choice(i) | 51 | 4.16k | } |
nom::branch::alt::<&str, suricata::detect::uint::DetectUintData<u16>, nom::error::Error<&str>, (suricata::detect::uint::detect_parse_uint_start_interval<u16>, suricata::detect::uint::detect_parse_uint_start_equal<u16>, suricata::detect::uint::detect_parse_uint_start_symbol<u16>)> Line | Count | Source | 47 | 18.8k | pub fn alt<I: Clone, O, E: ParseError<I>, List: Alt<I, O, E>>( | 48 | 18.8k | mut l: List, | 49 | 18.8k | ) -> impl FnMut(I) -> IResult<I, O, E> { | 50 | | move |i: I| l.choice(i) | 51 | 18.8k | } |
nom::branch::alt::<&str, suricata::detect::uint::DetectUintData<u64>, nom::error::Error<&str>, (suricata::detect::uint::detect_parse_uint_start_interval<u64>, suricata::detect::uint::detect_parse_uint_start_equal<u64>, suricata::detect::uint::detect_parse_uint_start_symbol<u64>)> Line | Count | Source | 47 | 14.0k | pub fn alt<I: Clone, O, E: ParseError<I>, List: Alt<I, O, E>>( | 48 | 14.0k | mut l: List, | 49 | 14.0k | ) -> impl FnMut(I) -> IResult<I, O, E> { | 50 | | move |i: I| l.choice(i) | 51 | 14.0k | } |
nom::branch::alt::<&str, suricata::detect::uint::DetectUintMode, nom::error::Error<&str>, (nom::combinator::value<&str, suricata::detect::uint::DetectUintMode, &str, nom::error::Error<&str>, nom::bytes::complete::tag<&str, &str, nom::error::Error<&str>>::{closure#0}>::{closure#0}, nom::combinator::value<&str, suricata::detect::uint::DetectUintMode, &str, nom::error::Error<&str>, nom::bytes::complete::tag<&str, &str, nom::error::Error<&str>>::{closure#0}>::{closure#0}, nom::combinator::value<&str, suricata::detect::uint::DetectUintMode, &str, nom::error::Error<&str>, nom::bytes::complete::tag<&str, &str, nom::error::Error<&str>>::{closure#0}>::{closure#0}, nom::combinator::value<&str, suricata::detect::uint::DetectUintMode, &str, nom::error::Error<&str>, nom::bytes::complete::tag<&str, &str, nom::error::Error<&str>>::{closure#0}>::{closure#0}, nom::combinator::value<&str, suricata::detect::uint::DetectUintMode, &str, nom::error::Error<&str>, nom::bytes::complete::tag<&str, &str, nom::error::Error<&str>>::{closure#0}>::{closure#0}, nom::combinator::value<&str, suricata::detect::uint::DetectUintMode, &str, nom::error::Error<&str>, nom::bytes::complete::tag<&str, &str, nom::error::Error<&str>>::{closure#0}>::{closure#0}, nom::combinator::value<&str, suricata::detect::uint::DetectUintMode, &str, nom::error::Error<&str>, nom::bytes::complete::tag<&str, &str, nom::error::Error<&str>>::{closure#0}>::{closure#0})>Line | Count | Source | 47 | 27.0k | pub fn alt<I: Clone, O, E: ParseError<I>, List: Alt<I, O, E>>( | 48 | 27.0k | mut l: List, | 49 | 27.0k | ) -> impl FnMut(I) -> IResult<I, O, E> { | 50 | | move |i: I| l.choice(i) | 51 | 27.0k | } |
nom::branch::alt::<&str, suricata::detect::requires::VersionCompareOp, nom::error::Error<&str>, (nom::combinator::map<&str, &str, suricata::detect::requires::VersionCompareOp, nom::error::Error<&str>, nom::bytes::complete::tag<&str, &str, nom::error::Error<&str>>::{closure#0}, suricata::detect::requires::parse_op::{closure#0}>::{closure#0}, nom::combinator::map<&str, &str, suricata::detect::requires::VersionCompareOp, nom::error::Error<&str>, nom::bytes::complete::tag<&str, &str, nom::error::Error<&str>>::{closure#0}, suricata::detect::requires::parse_op::{closure#1}>::{closure#0}, nom::combinator::map<&str, &str, suricata::detect::requires::VersionCompareOp, nom::error::Error<&str>, nom::bytes::complete::tag<&str, &str, nom::error::Error<&str>>::{closure#0}, suricata::detect::requires::parse_op::{closure#2}>::{closure#0}, nom::combinator::map<&str, &str, suricata::detect::requires::VersionCompareOp, nom::error::Error<&str>, nom::bytes::complete::tag<&str, &str, nom::error::Error<&str>>::{closure#0}, suricata::detect::requires::parse_op::{closure#3}>::{closure#0})>Line | Count | Source | 47 | 40.7k | pub fn alt<I: Clone, O, E: ParseError<I>, List: Alt<I, O, E>>( | 48 | 40.7k | mut l: List, | 49 | 40.7k | ) -> impl FnMut(I) -> IResult<I, O, E> { | 50 | | move |i: I| l.choice(i) | 51 | 40.7k | } |
nom::branch::alt::<&str, u64, nom::error::Error<&str>, (nom::combinator::value<&str, u64, &str, nom::error::Error<&str>, nom::bytes::complete::tag_no_case<&str, &str, nom::error::Error<&str>>::{closure#0}>::{closure#0}, nom::combinator::value<&str, u64, &str, nom::error::Error<&str>, nom::bytes::complete::tag_no_case<&str, &str, nom::error::Error<&str>>::{closure#0}>::{closure#0}, nom::combinator::value<&str, u64, &str, nom::error::Error<&str>, nom::bytes::complete::tag_no_case<&str, &str, nom::error::Error<&str>>::{closure#0}>::{closure#0})>Line | Count | Source | 47 | 32.5k | pub fn alt<I: Clone, O, E: ParseError<I>, List: Alt<I, O, E>>( | 48 | 32.5k | mut l: List, | 49 | 32.5k | ) -> impl FnMut(I) -> IResult<I, O, E> { | 50 | | move |i: I| l.choice(i) | 51 | 32.5k | } |
nom::branch::alt::<&[u8], &[u8], nom::error::Error<&[u8]>, (nom::combinator::complete<&[u8], &[u8], nom::error::Error<&[u8]>, nom::bytes::streaming::is_not<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}>::{closure#0}, nom::combinator::rest<&[u8], nom::error::Error<&[u8]>>)>Line | Count | Source | 47 | 3.24k | pub fn alt<I: Clone, O, E: ParseError<I>, List: Alt<I, O, E>>( | 48 | 3.24k | mut l: List, | 49 | 3.24k | ) -> impl FnMut(I) -> IResult<I, O, E> { | 50 | | move |i: I| l.choice(i) | 51 | 3.24k | } |
nom::branch::alt::<&[u8], &[u8], nom::error::Error<&[u8]>, (nom::bytes::streaming::tag<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::bytes::streaming::tag<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::bytes::streaming::tag<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::bytes::streaming::tag<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::bytes::streaming::tag<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0})>Line | Count | Source | 47 | 4.62k | pub fn alt<I: Clone, O, E: ParseError<I>, List: Alt<I, O, E>>( | 48 | 4.62k | mut l: List, | 49 | 4.62k | ) -> impl FnMut(I) -> IResult<I, O, E> { | 50 | | move |i: I| l.choice(i) | 51 | 4.62k | } |
nom::branch::alt::<&[u8], &[u8], nom::error::Error<&[u8]>, (nom::bytes::streaming::tag<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::bytes::streaming::tag<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::bytes::streaming::tag<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0})>Line | Count | Source | 47 | 5.96k | pub fn alt<I: Clone, O, E: ParseError<I>, List: Alt<I, O, E>>( | 48 | 5.96k | mut l: List, | 49 | 5.96k | ) -> impl FnMut(I) -> IResult<I, O, E> { | 50 | | move |i: I| l.choice(i) | 51 | 5.96k | } |
nom::branch::alt::<&[u8], &[u8], nom::error::Error<&[u8]>, (nom::bytes::streaming::tag<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::bytes::streaming::tag<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}, suricata::ssh::parser::ssh_parse_line::parser)>Line | Count | Source | 47 | 59.3k | pub fn alt<I: Clone, O, E: ParseError<I>, List: Alt<I, O, E>>( | 48 | 59.3k | mut l: List, | 49 | 59.3k | ) -> impl FnMut(I) -> IResult<I, O, E> { | 50 | | move |i: I| l.choice(i) | 51 | 59.3k | } |
nom::branch::alt::<&[u8], char, nom::error::Error<&[u8]>, (nom::character::streaming::char<&[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::character::streaming::char<&[u8], nom::error::Error<&[u8]>>::{closure#0})>Line | Count | Source | 47 | 174k | pub fn alt<I: Clone, O, E: ParseError<I>, List: Alt<I, O, E>>( | 48 | 174k | mut l: List, | 49 | 174k | ) -> impl FnMut(I) -> IResult<I, O, E> { | 50 | | move |i: I| l.choice(i) | 51 | 174k | } |
nom::branch::alt::<&str, &str, nom::error::Error<&str>, (nom::combinator::complete<&str, &str, nom::error::Error<&str>, nom::bytes::streaming::is_not<&str, &str, nom::error::Error<&str>>::{closure#0}>::{closure#0}, nom::combinator::rest<&str, nom::error::Error<&str>>)>Line | Count | Source | 47 | 2.59k | pub fn alt<I: Clone, O, E: ParseError<I>, List: Alt<I, O, E>>( | 48 | 2.59k | mut l: List, | 49 | 2.59k | ) -> impl FnMut(I) -> IResult<I, O, E> { | 50 | | move |i: I| l.choice(i) | 51 | 2.59k | } |
nom::branch::alt::<&[u8], &[u8], nom::error::Error<&[u8]>, (suricata::mime::mime_parse_value_delimited, nom::combinator::complete<&[u8], &[u8], nom::error::Error<&[u8]>, nom::bytes::streaming::take_until<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}>::{closure#0}, nom::combinator::rest<&[u8], nom::error::Error<&[u8]>>)>Line | Count | Source | 47 | 4.57M | pub fn alt<I: Clone, O, E: ParseError<I>, List: Alt<I, O, E>>( | 48 | 4.57M | mut l: List, | 49 | 4.57M | ) -> impl FnMut(I) -> IResult<I, O, E> { | 50 | | move |i: I| l.choice(i) | 51 | 4.57M | } |
Unexecuted instantiation: nom::branch::alt::<&str, &str, nom::error::Error<&str>, (nom::number::complete::recognize_float_or_exceptions<&str, nom::error::Error<&str>>::{closure#0}, nom::number::complete::recognize_float_or_exceptions<&str, nom::error::Error<&str>>::{closure#1}, nom::number::complete::recognize_float_or_exceptions<&str, nom::error::Error<&str>>::{closure#2}, nom::number::complete::recognize_float_or_exceptions<&str, nom::error::Error<&str>>::{closure#3})>nom::branch::alt::<&str, suricata::krb::detect::DetectKrb5TicketEncryptionData, nom::error::Error<&str>, (suricata::krb::detect::detect_parse_encryption_weak, suricata::krb::detect::detect_parse_encryption_list)> Line | Count | Source | 47 | 1.27k | pub fn alt<I: Clone, O, E: ParseError<I>, List: Alt<I, O, E>>( | 48 | 1.27k | mut l: List, | 49 | 1.27k | ) -> impl FnMut(I) -> IResult<I, O, E> { | 50 | | move |i: I| l.choice(i) | 51 | 1.27k | } |
Unexecuted instantiation: nom::branch::alt::<&str, char, nom::error::Error<&str>, (nom::character::complete::char<&str, nom::error::Error<&str>>::{closure#0}, nom::character::complete::char<&str, nom::error::Error<&str>>::{closure#0})>Unexecuted instantiation: nom::branch::alt::<&str, (), nom::error::Error<&str>, (nom::combinator::map<&str, (&str, core::option::Option<(char, core::option::Option<&str>)>), (), nom::error::Error<&str>, nom::sequence::tuple<&str, (&str, core::option::Option<(char, core::option::Option<&str>)>), nom::error::Error<&str>, (nom::character::complete::digit1<&str, nom::error::Error<&str>>, nom::combinator::opt<&str, (char, core::option::Option<&str>), nom::error::Error<&str>, nom::sequence::pair<&str, char, core::option::Option<&str>, nom::error::Error<&str>, nom::character::complete::char<&str, nom::error::Error<&str>>::{closure#0}, nom::combinator::opt<&str, &str, nom::error::Error<&str>, nom::character::complete::digit1<&str, nom::error::Error<&str>>>::{closure#0}>::{closure#0}>::{closure#0})>::{closure#0}, nom::number::complete::recognize_float<&str, nom::error::Error<&str>>::{closure#0}>::{closure#0}, nom::combinator::map<&str, (char, &str), (), nom::error::Error<&str>, nom::sequence::tuple<&str, (char, &str), nom::error::Error<&str>, (nom::character::complete::char<&str, nom::error::Error<&str>>::{closure#0}, nom::character::complete::digit1<&str, nom::error::Error<&str>>)>::{closure#0}, nom::number::complete::recognize_float<&str, nom::error::Error<&str>>::{closure#1}>::{closure#0})>nom::branch::alt::<&[u8], asn1_rs::asn1_types::any::Any, asn1_rs::error::Error, (<asn1_rs::asn1_types::any::Any as asn1_rs::traits::FromDer>::from_der, x509_parser::x509::parse_malformed_string)> Line | Count | Source | 47 | 21.9k | pub fn alt<I: Clone, O, E: ParseError<I>, List: Alt<I, O, E>>( | 48 | 21.9k | mut l: List, | 49 | 21.9k | ) -> impl FnMut(I) -> IResult<I, O, E> { | 50 | | move |i: I| l.choice(i) | 51 | 21.9k | } |
Unexecuted instantiation: nom::branch::alt::<&[u8], der_parser::ber::ber::BerObject, asn1_rs::error::Error, (der_parser::der::parser::parse_der_utf8string, der_parser::der::parser::parse_der_printablestring, der_parser::der::parser::parse_der_universalstring, der_parser::der::parser::parse_der_bmpstring, der_parser::der::parser::parse_der_t61string)> nom::branch::alt::<&[u8], tls_parser::tls::TlsMessageHandshake, nom::error::Error<&[u8]>, (nom::combinator::complete<&[u8], tls_parser::tls::TlsMessageHandshake, nom::error::Error<&[u8]>, tls_parser::tls::parse_certrequest_full>::{closure#0}, nom::combinator::complete<&[u8], tls_parser::tls::TlsMessageHandshake, nom::error::Error<&[u8]>, tls_parser::tls::parse_certrequest_nosigalg>::{closure#0})>Line | Count | Source | 47 | 8.89k | pub fn alt<I: Clone, O, E: ParseError<I>, List: Alt<I, O, E>>( | 48 | 8.89k | mut l: List, | 49 | 8.89k | ) -> impl FnMut(I) -> IResult<I, O, E> { | 50 | | move |i: I| l.choice(i) | 51 | 8.89k | } |
Unexecuted instantiation: nom::branch::alt::<_, _, _, _> |
52 | | |
53 | | /// Helper trait for the [permutation()] combinator. |
54 | | /// |
55 | | /// This trait is implemented for tuples of up to 21 elements |
56 | | pub trait Permutation<I, O, E> { |
57 | | /// Tries to apply all parsers in the tuple in various orders until all of them succeed |
58 | | fn permutation(&mut self, input: I) -> IResult<I, O, E>; |
59 | | } |
60 | | |
61 | | /// Applies a list of parsers in any order. |
62 | | /// |
63 | | /// Permutation will succeed if all of the child parsers succeeded. |
64 | | /// It takes as argument a tuple of parsers, and returns a |
65 | | /// tuple of the parser results. |
66 | | /// |
67 | | /// ```rust |
68 | | /// # use nom::{Err,error::{Error, ErrorKind}, Needed, IResult}; |
69 | | /// use nom::character::complete::{alpha1, digit1}; |
70 | | /// use nom::branch::permutation; |
71 | | /// # fn main() { |
72 | | /// fn parser(input: &str) -> IResult<&str, (&str, &str)> { |
73 | | /// permutation((alpha1, digit1))(input) |
74 | | /// } |
75 | | /// |
76 | | /// // permutation recognizes alphabetic characters then digit |
77 | | /// assert_eq!(parser("abc123"), Ok(("", ("abc", "123")))); |
78 | | /// |
79 | | /// // but also in inverse order |
80 | | /// assert_eq!(parser("123abc"), Ok(("", ("abc", "123")))); |
81 | | /// |
82 | | /// // it will fail if one of the parsers failed |
83 | | /// assert_eq!(parser("abc;"), Err(Err::Error(Error::new(";", ErrorKind::Digit)))); |
84 | | /// # } |
85 | | /// ``` |
86 | | /// |
87 | | /// The parsers are applied greedily: if there are multiple unapplied parsers |
88 | | /// that could parse the next slice of input, the first one is used. |
89 | | /// ```rust |
90 | | /// # use nom::{Err, error::{Error, ErrorKind}, IResult}; |
91 | | /// use nom::branch::permutation; |
92 | | /// use nom::character::complete::{anychar, char}; |
93 | | /// |
94 | | /// fn parser(input: &str) -> IResult<&str, (char, char)> { |
95 | | /// permutation((anychar, char('a')))(input) |
96 | | /// } |
97 | | /// |
98 | | /// // anychar parses 'b', then char('a') parses 'a' |
99 | | /// assert_eq!(parser("ba"), Ok(("", ('b', 'a')))); |
100 | | /// |
101 | | /// // anychar parses 'a', then char('a') fails on 'b', |
102 | | /// // even though char('a') followed by anychar would succeed |
103 | | /// assert_eq!(parser("ab"), Err(Err::Error(Error::new("b", ErrorKind::Char)))); |
104 | | /// ``` |
105 | | /// |
106 | 0 | pub fn permutation<I: Clone, O, E: ParseError<I>, List: Permutation<I, O, E>>( |
107 | 0 | mut l: List, |
108 | 0 | ) -> impl FnMut(I) -> IResult<I, O, E> { |
109 | 0 | move |i: I| l.permutation(i) Unexecuted instantiation: nom::branch::permutation::<_, _, _, _>::{closure#0}Unexecuted instantiation: nom::branch::permutation::<_, _, _, _>::{closure#0} |
110 | 0 | } Unexecuted instantiation: nom::branch::permutation::<_, _, _, _> Unexecuted instantiation: nom::branch::permutation::<_, _, _, _> |
111 | | |
112 | | macro_rules! alt_trait( |
113 | | ($first:ident $second:ident $($id: ident)+) => ( |
114 | | alt_trait!(__impl $first $second; $($id)+); |
115 | | ); |
116 | | (__impl $($current:ident)*; $head:ident $($id: ident)+) => ( |
117 | | alt_trait_impl!($($current)*); |
118 | | |
119 | | alt_trait!(__impl $($current)* $head; $($id)+); |
120 | | ); |
121 | | (__impl $($current:ident)*; $head:ident) => ( |
122 | | alt_trait_impl!($($current)*); |
123 | | alt_trait_impl!($($current)* $head); |
124 | | ); |
125 | | ); |
126 | | |
127 | | macro_rules! alt_trait_impl( |
128 | | ($($id:ident)+) => ( |
129 | | impl< |
130 | | Input: Clone, Output, Error: ParseError<Input>, |
131 | | $($id: Parser<Input, Output, Error>),+ |
132 | | > Alt<Input, Output, Error> for ( $($id),+ ) { |
133 | | |
134 | 106M | fn choice(&mut self, input: Input) -> IResult<Input, Output, Error> { |
135 | 106M | match self.0.parse(input.clone()) { |
136 | 60.9M | Err(Err::Error(e)) => alt_trait_inner!(1, self, input, e, $($id)+), |
137 | 45.8M | res => res, |
138 | | } |
139 | 106M | } <(suricata::http2::huffman::http2_decode_huffman_len28, suricata::http2::huffman::http2_decode_huffman_len30, suricata::http2::huffman::http2_decode_huffman_end) as nom::branch::Alt<(&[u8], usize), u8, nom::error::Error<(&[u8], usize)>>>::choice Line | Count | Source | 134 | 1.59M | fn choice(&mut self, input: Input) -> IResult<Input, Output, Error> { | 135 | 1.59M | match self.0.parse(input.clone()) { | 136 | 1.52M | Err(Err::Error(e)) => alt_trait_inner!(1, self, input, e, $($id)+), | 137 | 78.7k | res => res, | 138 | | } | 139 | 1.59M | } |
<(suricata::http2::huffman::http2_decode_huffman_len5, suricata::http2::huffman::http2_decode_huffman_len6, suricata::http2::huffman::http2_decode_huffman_len7, suricata::http2::huffman::http2_decode_huffman_len8, suricata::http2::huffman::http2_decode_huffman_len10, suricata::http2::huffman::http2_decode_huffman_len11, suricata::http2::huffman::http2_decode_huffman_len12, suricata::http2::huffman::http2_decode_huffman_len13, suricata::http2::huffman::http2_decode_huffman_len14, suricata::http2::huffman::http2_decode_huffman_len15, suricata::http2::huffman::http2_decode_huffman_len19, suricata::http2::huffman::http2_decode_huffman_len20, suricata::http2::huffman::http2_decode_huffman_len21, suricata::http2::huffman::http2_decode_huffman_len21, suricata::http2::huffman::http2_decode_huffman_len22, suricata::http2::huffman::http2_decode_huffman_len23, suricata::http2::huffman::http2_decode_huffman_len24, suricata::http2::huffman::http2_decode_huffman_len25, suricata::http2::huffman::http2_decode_huffman_len26, suricata::http2::huffman::http2_decode_huffman_len27, nom::branch::alt<(&[u8], usize), u8, nom::error::Error<(&[u8], usize)>, (suricata::http2::huffman::http2_decode_huffman_len28, suricata::http2::huffman::http2_decode_huffman_len30, suricata::http2::huffman::http2_decode_huffman_end)>::{closure#0}) as nom::branch::Alt<(&[u8], usize), u8, nom::error::Error<(&[u8], usize)>>>::choiceLine | Count | Source | 134 | 52.9M | fn choice(&mut self, input: Input) -> IResult<Input, Output, Error> { | 135 | 52.9M | match self.0.parse(input.clone()) { | 136 | 30.6M | Err(Err::Error(e)) => alt_trait_inner!(1, self, input, e, $($id)+), | 137 | 22.2M | res => res, | 138 | | } | 139 | 52.9M | } |
<(nom::combinator::value<&[u8], i64, char, nom::error::Error<&[u8]>, nom::character::complete::char<&[u8], nom::error::Error<&[u8]>>::{closure#0}>::{closure#0}, nom::combinator::map_res<&[u8], &str, i64, nom::error::Error<&[u8]>, core::num::error::ParseIntError, nom::combinator::map_res<&[u8], &[u8], &str, nom::error::Error<&[u8]>, core::str::error::Utf8Error, nom::character::complete::digit1<&[u8], nom::error::Error<&[u8]>>, core::str::converts::from_utf8>::{closure#0}, <i64 as core::str::traits::FromStr>::from_str>::{closure#0}) as nom::branch::Alt<&[u8], i64, nom::error::Error<&[u8]>>>::choiceLine | Count | Source | 134 | 66.5k | fn choice(&mut self, input: Input) -> IResult<Input, Output, Error> { | 135 | 66.5k | match self.0.parse(input.clone()) { | 136 | 66.3k | Err(Err::Error(e)) => alt_trait_inner!(1, self, input, e, $($id)+), | 137 | 204 | res => res, | 138 | | } | 139 | 66.5k | } |
<(suricata::http2::range::http2_parse_content_range_star, suricata::http2::range::http2_parse_content_range_def) as nom::branch::Alt<&[u8], suricata::http2::range::HTTPContentRange, nom::error::Error<&[u8]>>>::choice Line | Count | Source | 134 | 77.8k | fn choice(&mut self, input: Input) -> IResult<Input, Output, Error> { | 135 | 77.8k | match self.0.parse(input.clone()) { | 136 | 77.5k | Err(Err::Error(e)) => alt_trait_inner!(1, self, input, e, $($id)+), | 137 | 318 | res => res, | 138 | | } | 139 | 77.8k | } |
Unexecuted instantiation: <(der_parser::der::parser::parse_der_utf8string, der_parser::der::parser::parse_der_printablestring, der_parser::der::parser::parse_der_universalstring, der_parser::der::parser::parse_der_bmpstring, der_parser::der::parser::parse_der_t61string) as nom::branch::Alt<&[u8], der_parser::ber::ber::BerObject, asn1_rs::error::Error>>::choice <(<asn1_rs::asn1_types::any::Any as asn1_rs::traits::FromDer>::from_der, x509_parser::x509::parse_malformed_string) as nom::branch::Alt<&[u8], asn1_rs::asn1_types::any::Any, asn1_rs::error::Error>>::choice Line | Count | Source | 134 | 29.0k | fn choice(&mut self, input: Input) -> IResult<Input, Output, Error> { | 135 | 29.0k | match self.0.parse(input.clone()) { | 136 | 125 | Err(Err::Error(e)) => alt_trait_inner!(1, self, input, e, $($id)+), | 137 | 28.9k | res => res, | 138 | | } | 139 | 29.0k | } |
<(nom::combinator::complete<&[u8], tls_parser::tls::TlsMessageHandshake, nom::error::Error<&[u8]>, tls_parser::tls::parse_certrequest_full>::{closure#0}, nom::combinator::complete<&[u8], tls_parser::tls::TlsMessageHandshake, nom::error::Error<&[u8]>, tls_parser::tls::parse_certrequest_nosigalg>::{closure#0}) as nom::branch::Alt<&[u8], tls_parser::tls::TlsMessageHandshake, nom::error::Error<&[u8]>>>::choiceLine | Count | Source | 134 | 91.0k | fn choice(&mut self, input: Input) -> IResult<Input, Output, Error> { | 135 | 91.0k | match self.0.parse(input.clone()) { | 136 | 90.1k | Err(Err::Error(e)) => alt_trait_inner!(1, self, input, e, $($id)+), | 137 | 923 | res => res, | 138 | | } | 139 | 91.0k | } |
Unexecuted instantiation: <(_, _, _) as nom::branch::Alt<_, _, _>>::choice Unexecuted instantiation: <(_, _, _, _) as nom::branch::Alt<_, _, _>>::choice Unexecuted instantiation: <(_, _, _, _, _) as nom::branch::Alt<_, _, _>>::choice Unexecuted instantiation: <(_, _, _, _, _, _) as nom::branch::Alt<_, _, _>>::choice Unexecuted instantiation: <(_, _, _, _, _, _, _) as nom::branch::Alt<_, _, _>>::choice Unexecuted instantiation: <(_, _, _, _, _, _, _, _) as nom::branch::Alt<_, _, _>>::choice Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _) as nom::branch::Alt<_, _, _>>::choice Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _) as nom::branch::Alt<_, _, _>>::choice Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _) as nom::branch::Alt<_, _, _>>::choice Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _, _) as nom::branch::Alt<_, _, _>>::choice Unexecuted instantiation: <(_, _) as nom::branch::Alt<_, _, _>>::choice Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _, _, _) as nom::branch::Alt<_, _, _>>::choice Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _, _, _, _) as nom::branch::Alt<_, _, _>>::choice Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _) as nom::branch::Alt<_, _, _>>::choice Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _) as nom::branch::Alt<_, _, _>>::choice Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _) as nom::branch::Alt<_, _, _>>::choice Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _) as nom::branch::Alt<_, _, _>>::choice Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _) as nom::branch::Alt<_, _, _>>::choice Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _) as nom::branch::Alt<_, _, _>>::choice Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _) as nom::branch::Alt<_, _, _>>::choice <(nom::combinator::value<&str, u64, &str, nom::error::Error<&str>, nom::bytes::complete::tag_no_case<&str, &str, nom::error::Error<&str>>::{closure#0}>::{closure#0}, nom::combinator::value<&str, u64, &str, nom::error::Error<&str>, nom::bytes::complete::tag_no_case<&str, &str, nom::error::Error<&str>>::{closure#0}>::{closure#0}, nom::combinator::value<&str, u64, &str, nom::error::Error<&str>, nom::bytes::complete::tag_no_case<&str, &str, nom::error::Error<&str>>::{closure#0}>::{closure#0}) as nom::branch::Alt<&str, u64, nom::error::Error<&str>>>::choiceLine | Count | Source | 134 | 32.5k | fn choice(&mut self, input: Input) -> IResult<Input, Output, Error> { | 135 | 32.5k | match self.0.parse(input.clone()) { | 136 | 31.8k | Err(Err::Error(e)) => alt_trait_inner!(1, self, input, e, $($id)+), | 137 | 720 | res => res, | 138 | | } | 139 | 32.5k | } |
<(suricata::http2::huffman::http2_decode_huffman_len28, suricata::http2::huffman::http2_decode_huffman_len30, suricata::http2::huffman::http2_decode_huffman_end) as nom::branch::Alt<(&[u8], usize), u8, nom::error::Error<(&[u8], usize)>>>::choice Line | Count | Source | 134 | 569k | fn choice(&mut self, input: Input) -> IResult<Input, Output, Error> { | 135 | 569k | match self.0.parse(input.clone()) { | 136 | 469k | Err(Err::Error(e)) => alt_trait_inner!(1, self, input, e, $($id)+), | 137 | 99.3k | res => res, | 138 | | } | 139 | 569k | } |
<(nom::combinator::map<&str, &str, suricata::detect::requires::VersionCompareOp, nom::error::Error<&str>, nom::bytes::complete::tag<&str, &str, nom::error::Error<&str>>::{closure#0}, suricata::detect::requires::parse_op::{closure#0}>::{closure#0}, nom::combinator::map<&str, &str, suricata::detect::requires::VersionCompareOp, nom::error::Error<&str>, nom::bytes::complete::tag<&str, &str, nom::error::Error<&str>>::{closure#0}, suricata::detect::requires::parse_op::{closure#1}>::{closure#0}, nom::combinator::map<&str, &str, suricata::detect::requires::VersionCompareOp, nom::error::Error<&str>, nom::bytes::complete::tag<&str, &str, nom::error::Error<&str>>::{closure#0}, suricata::detect::requires::parse_op::{closure#2}>::{closure#0}, nom::combinator::map<&str, &str, suricata::detect::requires::VersionCompareOp, nom::error::Error<&str>, nom::bytes::complete::tag<&str, &str, nom::error::Error<&str>>::{closure#0}, suricata::detect::requires::parse_op::{closure#3}>::{closure#0}) as nom::branch::Alt<&str, suricata::detect::requires::VersionCompareOp, nom::error::Error<&str>>>::choiceLine | Count | Source | 134 | 40.7k | fn choice(&mut self, input: Input) -> IResult<Input, Output, Error> { | 135 | 40.7k | match self.0.parse(input.clone()) { | 136 | 32.7k | Err(Err::Error(e)) => alt_trait_inner!(1, self, input, e, $($id)+), | 137 | 7.98k | res => res, | 138 | | } | 139 | 40.7k | } |
<(nom::combinator::value<&str, suricata::detect::uint::DetectUintMode, &str, nom::error::Error<&str>, nom::bytes::complete::tag<&str, &str, nom::error::Error<&str>>::{closure#0}>::{closure#0}, nom::combinator::value<&str, suricata::detect::uint::DetectUintMode, &str, nom::error::Error<&str>, nom::bytes::complete::tag<&str, &str, nom::error::Error<&str>>::{closure#0}>::{closure#0}, nom::combinator::value<&str, suricata::detect::uint::DetectUintMode, &str, nom::error::Error<&str>, nom::bytes::complete::tag<&str, &str, nom::error::Error<&str>>::{closure#0}>::{closure#0}, nom::combinator::value<&str, suricata::detect::uint::DetectUintMode, &str, nom::error::Error<&str>, nom::bytes::complete::tag<&str, &str, nom::error::Error<&str>>::{closure#0}>::{closure#0}, nom::combinator::value<&str, suricata::detect::uint::DetectUintMode, &str, nom::error::Error<&str>, nom::bytes::complete::tag<&str, &str, nom::error::Error<&str>>::{closure#0}>::{closure#0}, nom::combinator::value<&str, suricata::detect::uint::DetectUintMode, &str, nom::error::Error<&str>, nom::bytes::complete::tag<&str, &str, nom::error::Error<&str>>::{closure#0}>::{closure#0}, nom::combinator::value<&str, suricata::detect::uint::DetectUintMode, &str, nom::error::Error<&str>, nom::bytes::complete::tag<&str, &str, nom::error::Error<&str>>::{closure#0}>::{closure#0}) as nom::branch::Alt<&str, suricata::detect::uint::DetectUintMode, nom::error::Error<&str>>>::choiceLine | Count | Source | 134 | 27.0k | fn choice(&mut self, input: Input) -> IResult<Input, Output, Error> { | 135 | 27.0k | match self.0.parse(input.clone()) { | 136 | 24.8k | Err(Err::Error(e)) => alt_trait_inner!(1, self, input, e, $($id)+), | 137 | 2.20k | res => res, | 138 | | } | 139 | 27.0k | } |
Unexecuted instantiation: <(nom::combinator::map<&str, (&str, core::option::Option<(char, core::option::Option<&str>)>), (), nom::error::Error<&str>, nom::sequence::tuple<&str, (&str, core::option::Option<(char, core::option::Option<&str>)>), nom::error::Error<&str>, (nom::character::complete::digit1<&str, nom::error::Error<&str>>, nom::combinator::opt<&str, (char, core::option::Option<&str>), nom::error::Error<&str>, nom::sequence::pair<&str, char, core::option::Option<&str>, nom::error::Error<&str>, nom::character::complete::char<&str, nom::error::Error<&str>>::{closure#0}, nom::combinator::opt<&str, &str, nom::error::Error<&str>, nom::character::complete::digit1<&str, nom::error::Error<&str>>>::{closure#0}>::{closure#0}>::{closure#0})>::{closure#0}, nom::number::complete::recognize_float<&str, nom::error::Error<&str>>::{closure#0}>::{closure#0}, nom::combinator::map<&str, (char, &str), (), nom::error::Error<&str>, nom::sequence::tuple<&str, (char, &str), nom::error::Error<&str>, (nom::character::complete::char<&str, nom::error::Error<&str>>::{closure#0}, nom::character::complete::digit1<&str, nom::error::Error<&str>>)>::{closure#0}, nom::number::complete::recognize_float<&str, nom::error::Error<&str>>::{closure#1}>::{closure#0}) as nom::branch::Alt<&str, (), nom::error::Error<&str>>>::choice<(nom::combinator::value<&[u8], i64, char, nom::error::Error<&[u8]>, nom::character::complete::char<&[u8], nom::error::Error<&[u8]>>::{closure#0}>::{closure#0}, nom::combinator::map_res<&[u8], &str, i64, nom::error::Error<&[u8]>, core::num::error::ParseIntError, nom::combinator::map_res<&[u8], &[u8], &str, nom::error::Error<&[u8]>, core::str::error::Utf8Error, nom::character::complete::digit1<&[u8], nom::error::Error<&[u8]>>, core::str::converts::from_utf8>::{closure#0}, <i64 as core::str::traits::FromStr>::from_str>::{closure#0}) as nom::branch::Alt<&[u8], i64, nom::error::Error<&[u8]>>>::choiceLine | Count | Source | 134 | 13.3k | fn choice(&mut self, input: Input) -> IResult<Input, Output, Error> { | 135 | 13.3k | match self.0.parse(input.clone()) { | 136 | 13.3k | Err(Err::Error(e)) => alt_trait_inner!(1, self, input, e, $($id)+), | 137 | 1 | res => res, | 138 | | } | 139 | 13.3k | } |
<(nom::combinator::value<&str, bool, &str, nom::error::Error<&str>, nom::bytes::complete::tag<&str, &str, nom::error::Error<&str>>::{closure#0}>::{closure#0}, nom::combinator::value<&str, bool, &str, nom::error::Error<&str>, nom::bytes::complete::tag<&str, &str, nom::error::Error<&str>>::{closure#0}>::{closure#0}) as nom::branch::Alt<&str, bool, nom::error::Error<&str>>>::choiceLine | Count | Source | 134 | 435 | fn choice(&mut self, input: Input) -> IResult<Input, Output, Error> { | 135 | 435 | match self.0.parse(input.clone()) { | 136 | 424 | Err(Err::Error(e)) => alt_trait_inner!(1, self, input, e, $($id)+), | 137 | 11 | res => res, | 138 | | } | 139 | 435 | } |
<(nom::combinator::complete<&[u8], &[u8], nom::error::Error<&[u8]>, nom::bytes::streaming::is_not<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}>::{closure#0}, nom::combinator::rest<&[u8], nom::error::Error<&[u8]>>) as nom::branch::Alt<&[u8], &[u8], nom::error::Error<&[u8]>>>::choiceLine | Count | Source | 134 | 3.24k | fn choice(&mut self, input: Input) -> IResult<Input, Output, Error> { | 135 | 3.24k | match self.0.parse(input.clone()) { | 136 | 2.85k | Err(Err::Error(e)) => alt_trait_inner!(1, self, input, e, $($id)+), | 137 | 394 | res => res, | 138 | | } | 139 | 3.24k | } |
<(nom::combinator::complete<&str, &str, nom::error::Error<&str>, nom::bytes::streaming::is_not<&str, &str, nom::error::Error<&str>>::{closure#0}>::{closure#0}, nom::combinator::rest<&str, nom::error::Error<&str>>) as nom::branch::Alt<&str, &str, nom::error::Error<&str>>>::choiceLine | Count | Source | 134 | 2.59k | fn choice(&mut self, input: Input) -> IResult<Input, Output, Error> { | 135 | 2.59k | match self.0.parse(input.clone()) { | 136 | 2.21k | Err(Err::Error(e)) => alt_trait_inner!(1, self, input, e, $($id)+), | 137 | 381 | res => res, | 138 | | } | 139 | 2.59k | } |
<(suricata::http2::range::http2_parse_content_range_star, suricata::http2::range::http2_parse_content_range_def) as nom::branch::Alt<&[u8], suricata::http2::range::HTTPContentRange, nom::error::Error<&[u8]>>>::choice Line | Count | Source | 134 | 17.5k | fn choice(&mut self, input: Input) -> IResult<Input, Output, Error> { | 135 | 17.5k | match self.0.parse(input.clone()) { | 136 | 17.0k | Err(Err::Error(e)) => alt_trait_inner!(1, self, input, e, $($id)+), | 137 | 461 | res => res, | 138 | | } | 139 | 17.5k | } |
<(suricata::http2::huffman::http2_decode_huffman_len5, suricata::http2::huffman::http2_decode_huffman_len6, suricata::http2::huffman::http2_decode_huffman_len7, suricata::http2::huffman::http2_decode_huffman_len8, suricata::http2::huffman::http2_decode_huffman_len10, suricata::http2::huffman::http2_decode_huffman_len11, suricata::http2::huffman::http2_decode_huffman_len12, suricata::http2::huffman::http2_decode_huffman_len13, suricata::http2::huffman::http2_decode_huffman_len14, suricata::http2::huffman::http2_decode_huffman_len15, suricata::http2::huffman::http2_decode_huffman_len19, suricata::http2::huffman::http2_decode_huffman_len20, suricata::http2::huffman::http2_decode_huffman_len21, suricata::http2::huffman::http2_decode_huffman_len21, suricata::http2::huffman::http2_decode_huffman_len22, suricata::http2::huffman::http2_decode_huffman_len23, suricata::http2::huffman::http2_decode_huffman_len24, suricata::http2::huffman::http2_decode_huffman_len25, suricata::http2::huffman::http2_decode_huffman_len26, suricata::http2::huffman::http2_decode_huffman_len27, nom::branch::alt<(&[u8], usize), u8, nom::error::Error<(&[u8], usize)>, (suricata::http2::huffman::http2_decode_huffman_len28, suricata::http2::huffman::http2_decode_huffman_len30, suricata::http2::huffman::http2_decode_huffman_end)>::{closure#0}) as nom::branch::Alt<(&[u8], usize), u8, nom::error::Error<(&[u8], usize)>>>::choiceLine | Count | Source | 134 | 46.3M | fn choice(&mut self, input: Input) -> IResult<Input, Output, Error> { | 135 | 46.3M | match self.0.parse(input.clone()) { | 136 | 23.4M | Err(Err::Error(e)) => alt_trait_inner!(1, self, input, e, $($id)+), | 137 | 22.8M | res => res, | 138 | | } | 139 | 46.3M | } |
<(suricata::detect::uint::detect_parse_uint_start_interval<u8>, suricata::detect::uint::detect_parse_uint_start_equal<u8>, suricata::detect::uint::detect_parse_uint_start_symbol<u8>) as nom::branch::Alt<&str, suricata::detect::uint::DetectUintData<u8>, nom::error::Error<&str>>>::choice Line | Count | Source | 134 | 17.6k | fn choice(&mut self, input: Input) -> IResult<Input, Output, Error> { | 135 | 17.6k | match self.0.parse(input.clone()) { | 136 | 16.6k | Err(Err::Error(e)) => alt_trait_inner!(1, self, input, e, $($id)+), | 137 | 927 | res => res, | 138 | | } | 139 | 17.6k | } |
<(suricata::detect::uint::detect_parse_uint_start_interval<u32>, suricata::detect::uint::detect_parse_uint_start_equal<u32>, suricata::detect::uint::detect_parse_uint_start_symbol<u32>) as nom::branch::Alt<&str, suricata::detect::uint::DetectUintData<u32>, nom::error::Error<&str>>>::choice Line | Count | Source | 134 | 7.67k | fn choice(&mut self, input: Input) -> IResult<Input, Output, Error> { | 135 | 7.67k | match self.0.parse(input.clone()) { | 136 | 7.24k | Err(Err::Error(e)) => alt_trait_inner!(1, self, input, e, $($id)+), | 137 | 430 | res => res, | 138 | | } | 139 | 7.67k | } |
<(suricata::detect::uint::detect_parse_uint_start_interval<u16>, suricata::detect::uint::detect_parse_uint_start_equal<u16>, suricata::detect::uint::detect_parse_uint_start_symbol<u16>) as nom::branch::Alt<&str, suricata::detect::uint::DetectUintData<u16>, nom::error::Error<&str>>>::choice Line | Count | Source | 134 | 18.8k | fn choice(&mut self, input: Input) -> IResult<Input, Output, Error> { | 135 | 18.8k | match self.0.parse(input.clone()) { | 136 | 18.2k | Err(Err::Error(e)) => alt_trait_inner!(1, self, input, e, $($id)+), | 137 | 605 | res => res, | 138 | | } | 139 | 18.8k | } |
<(suricata::detect::uint::detect_parse_uint_start_interval<u64>, suricata::detect::uint::detect_parse_uint_start_equal<u64>, suricata::detect::uint::detect_parse_uint_start_symbol<u64>) as nom::branch::Alt<&str, suricata::detect::uint::DetectUintData<u64>, nom::error::Error<&str>>>::choice Line | Count | Source | 134 | 14.0k | fn choice(&mut self, input: Input) -> IResult<Input, Output, Error> { | 135 | 14.0k | match self.0.parse(input.clone()) { | 136 | 12.2k | Err(Err::Error(e)) => alt_trait_inner!(1, self, input, e, $($id)+), | 137 | 1.83k | res => res, | 138 | | } | 139 | 14.0k | } |
<(suricata::detect::uint::detect_parse_uint_start_interval_inclusive<u32>, suricata::detect::uint::detect_parse_uint_start_equal<u32>, suricata::detect::uint::detect_parse_uint_start_symbol<u32>) as nom::branch::Alt<&str, suricata::detect::uint::DetectUintData<u32>, nom::error::Error<&str>>>::choice Line | Count | Source | 134 | 4.16k | fn choice(&mut self, input: Input) -> IResult<Input, Output, Error> { | 135 | 4.16k | match self.0.parse(input.clone()) { | 136 | 3.63k | Err(Err::Error(e)) => alt_trait_inner!(1, self, input, e, $($id)+), | 137 | 536 | res => res, | 138 | | } | 139 | 4.16k | } |
<(nom::bytes::streaming::tag<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::bytes::streaming::tag<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::bytes::streaming::tag<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}) as nom::branch::Alt<&[u8], &[u8], nom::error::Error<&[u8]>>>::choiceLine | Count | Source | 134 | 5.96k | fn choice(&mut self, input: Input) -> IResult<Input, Output, Error> { | 135 | 5.96k | match self.0.parse(input.clone()) { | 136 | 4.19k | Err(Err::Error(e)) => alt_trait_inner!(1, self, input, e, $($id)+), | 137 | 1.76k | res => res, | 138 | | } | 139 | 5.96k | } |
<(nom::bytes::streaming::tag<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::bytes::streaming::tag<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}, suricata::ssh::parser::ssh_parse_line::parser) as nom::branch::Alt<&[u8], &[u8], nom::error::Error<&[u8]>>>::choiceLine | Count | Source | 134 | 22.7k | fn choice(&mut self, input: Input) -> IResult<Input, Output, Error> { | 135 | 22.7k | match self.0.parse(input.clone()) { | 136 | 6.23k | Err(Err::Error(e)) => alt_trait_inner!(1, self, input, e, $($id)+), | 137 | 16.4k | res => res, | 138 | | } | 139 | 22.7k | } |
<(nom::bytes::streaming::tag<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::bytes::streaming::tag<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::bytes::streaming::tag<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::bytes::streaming::tag<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::bytes::streaming::tag<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}) as nom::branch::Alt<&[u8], &[u8], nom::error::Error<&[u8]>>>::choiceLine | Count | Source | 134 | 4.62k | fn choice(&mut self, input: Input) -> IResult<Input, Output, Error> { | 135 | 4.62k | match self.0.parse(input.clone()) { | 136 | 3.47k | Err(Err::Error(e)) => alt_trait_inner!(1, self, input, e, $($id)+), | 137 | 1.15k | res => res, | 138 | | } | 139 | 4.62k | } |
<(suricata::mime::mime_parse_value_delimited, nom::combinator::complete<&[u8], &[u8], nom::error::Error<&[u8]>, nom::bytes::streaming::take_until<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}>::{closure#0}, nom::combinator::rest<&[u8], nom::error::Error<&[u8]>>) as nom::branch::Alt<&[u8], &[u8], nom::error::Error<&[u8]>>>::choiceLine | Count | Source | 134 | 4.57M | fn choice(&mut self, input: Input) -> IResult<Input, Output, Error> { | 135 | 4.57M | match self.0.parse(input.clone()) { | 136 | 4.15M | Err(Err::Error(e)) => alt_trait_inner!(1, self, input, e, $($id)+), | 137 | 418k | res => res, | 138 | | } | 139 | 4.57M | } |
Unexecuted instantiation: <(nom::number::complete::recognize_float_or_exceptions<&str, nom::error::Error<&str>>::{closure#0}, nom::number::complete::recognize_float_or_exceptions<&str, nom::error::Error<&str>>::{closure#1}, nom::number::complete::recognize_float_or_exceptions<&str, nom::error::Error<&str>>::{closure#2}, nom::number::complete::recognize_float_or_exceptions<&str, nom::error::Error<&str>>::{closure#3}) as nom::branch::Alt<&str, &str, nom::error::Error<&str>>>::choice<(nom::character::complete::multispace1<&str, nom::error::Error<&str>>, nom::bytes::complete::tag<&str, &str, nom::error::Error<&str>>::{closure#0}) as nom::branch::Alt<&str, &str, nom::error::Error<&str>>>::choiceLine | Count | Source | 134 | 3.93k | fn choice(&mut self, input: Input) -> IResult<Input, Output, Error> { | 135 | 3.93k | match self.0.parse(input.clone()) { | 136 | 2.23k | Err(Err::Error(e)) => alt_trait_inner!(1, self, input, e, $($id)+), | 137 | 1.70k | res => res, | 138 | | } | 139 | 3.93k | } |
<(nom::bytes::complete::tag<&str, &str, nom::error::Error<&str>>::{closure#0}, nom::bytes::complete::tag<&str, &str, nom::error::Error<&str>>::{closure#0}) as nom::branch::Alt<&str, &str, nom::error::Error<&str>>>::choiceLine | Count | Source | 134 | 35.0k | fn choice(&mut self, input: Input) -> IResult<Input, Output, Error> { | 135 | 35.0k | match self.0.parse(input.clone()) { | 136 | 32.6k | Err(Err::Error(e)) => alt_trait_inner!(1, self, input, e, $($id)+), | 137 | 2.43k | res => res, | 138 | | } | 139 | 35.0k | } |
Unexecuted instantiation: <(nom::character::complete::char<&str, nom::error::Error<&str>>::{closure#0}, nom::character::complete::char<&str, nom::error::Error<&str>>::{closure#0}) as nom::branch::Alt<&str, char, nom::error::Error<&str>>>::choice<(suricata::krb::detect::detect_parse_encryption_weak, suricata::krb::detect::detect_parse_encryption_list) as nom::branch::Alt<&str, suricata::krb::detect::DetectKrb5TicketEncryptionData, nom::error::Error<&str>>>::choice Line | Count | Source | 134 | 1.27k | fn choice(&mut self, input: Input) -> IResult<Input, Output, Error> { | 135 | 1.27k | match self.0.parse(input.clone()) { | 136 | 1.10k | Err(Err::Error(e)) => alt_trait_inner!(1, self, input, e, $($id)+), | 137 | 166 | res => res, | 138 | | } | 139 | 1.27k | } |
<(nom::character::streaming::char<&[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::character::streaming::char<&[u8], nom::error::Error<&[u8]>>::{closure#0}) as nom::branch::Alt<&[u8], char, nom::error::Error<&[u8]>>>::choiceLine | Count | Source | 134 | 174k | fn choice(&mut self, input: Input) -> IResult<Input, Output, Error> { | 135 | 174k | match self.0.parse(input.clone()) { | 136 | 172k | Err(Err::Error(e)) => alt_trait_inner!(1, self, input, e, $($id)+), | 137 | 1.57k | res => res, | 138 | | } | 139 | 174k | } |
Unexecuted instantiation: <(der_parser::der::parser::parse_der_utf8string, der_parser::der::parser::parse_der_printablestring, der_parser::der::parser::parse_der_universalstring, der_parser::der::parser::parse_der_bmpstring, der_parser::der::parser::parse_der_t61string) as nom::branch::Alt<&[u8], der_parser::ber::ber::BerObject, asn1_rs::error::Error>>::choice <(<asn1_rs::asn1_types::any::Any as asn1_rs::traits::FromDer>::from_der, x509_parser::x509::parse_malformed_string) as nom::branch::Alt<&[u8], asn1_rs::asn1_types::any::Any, asn1_rs::error::Error>>::choice Line | Count | Source | 134 | 21.9k | fn choice(&mut self, input: Input) -> IResult<Input, Output, Error> { | 135 | 21.9k | match self.0.parse(input.clone()) { | 136 | 126 | Err(Err::Error(e)) => alt_trait_inner!(1, self, input, e, $($id)+), | 137 | 21.7k | res => res, | 138 | | } | 139 | 21.9k | } |
<(nom::combinator::complete<&[u8], tls_parser::tls::TlsMessageHandshake, nom::error::Error<&[u8]>, tls_parser::tls::parse_certrequest_full>::{closure#0}, nom::combinator::complete<&[u8], tls_parser::tls::TlsMessageHandshake, nom::error::Error<&[u8]>, tls_parser::tls::parse_certrequest_nosigalg>::{closure#0}) as nom::branch::Alt<&[u8], tls_parser::tls::TlsMessageHandshake, nom::error::Error<&[u8]>>>::choiceLine | Count | Source | 134 | 8.89k | fn choice(&mut self, input: Input) -> IResult<Input, Output, Error> { | 135 | 8.89k | match self.0.parse(input.clone()) { | 136 | 7.08k | Err(Err::Error(e)) => alt_trait_inner!(1, self, input, e, $($id)+), | 137 | 1.80k | res => res, | 138 | | } | 139 | 8.89k | } |
Unexecuted instantiation: <(_, _, _) as nom::branch::Alt<_, _, _>>::choice Unexecuted instantiation: <(_, _, _, _) as nom::branch::Alt<_, _, _>>::choice Unexecuted instantiation: <(_, _, _, _, _) as nom::branch::Alt<_, _, _>>::choice Unexecuted instantiation: <(_, _, _, _, _, _) as nom::branch::Alt<_, _, _>>::choice Unexecuted instantiation: <(_, _, _, _, _, _, _) as nom::branch::Alt<_, _, _>>::choice Unexecuted instantiation: <(_, _, _, _, _, _, _, _) as nom::branch::Alt<_, _, _>>::choice Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _) as nom::branch::Alt<_, _, _>>::choice Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _) as nom::branch::Alt<_, _, _>>::choice Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _) as nom::branch::Alt<_, _, _>>::choice Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _, _) as nom::branch::Alt<_, _, _>>::choice Unexecuted instantiation: <(_, _) as nom::branch::Alt<_, _, _>>::choice Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _, _, _) as nom::branch::Alt<_, _, _>>::choice Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _, _, _, _) as nom::branch::Alt<_, _, _>>::choice Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _) as nom::branch::Alt<_, _, _>>::choice Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _) as nom::branch::Alt<_, _, _>>::choice Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _) as nom::branch::Alt<_, _, _>>::choice Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _) as nom::branch::Alt<_, _, _>>::choice Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _) as nom::branch::Alt<_, _, _>>::choice Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _) as nom::branch::Alt<_, _, _>>::choice Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _) as nom::branch::Alt<_, _, _>>::choice |
140 | | } |
141 | | ); |
142 | | ); |
143 | | |
144 | | macro_rules! alt_trait_inner( |
145 | | ($it:tt, $self:expr, $input:expr, $err:expr, $head:ident $($id:ident)+) => ( |
146 | | match $self.$it.parse($input.clone()) { |
147 | | Err(Err::Error(e)) => { |
148 | | let err = $err.or(e); |
149 | | succ!($it, alt_trait_inner!($self, $input, err, $($id)+)) |
150 | | } |
151 | | res => res, |
152 | | } |
153 | | ); |
154 | | ($it:tt, $self:expr, $input:expr, $err:expr, $head:ident) => ( |
155 | | Err(Err::Error(Error::append($input, ErrorKind::Alt, $err))) |
156 | | ); |
157 | | ); |
158 | | |
159 | | alt_trait!(A B C D E F G H I J K L M N O P Q R S T U); |
160 | | |
161 | | // Manually implement Alt for (A,), the 1-tuple type |
162 | | impl<Input, Output, Error: ParseError<Input>, A: Parser<Input, Output, Error>> |
163 | | Alt<Input, Output, Error> for (A,) |
164 | | { |
165 | 0 | fn choice(&mut self, input: Input) -> IResult<Input, Output, Error> { |
166 | 0 | self.0.parse(input) |
167 | 0 | } Unexecuted instantiation: <(_,) as nom::branch::Alt<_, _, _>>::choice Unexecuted instantiation: <(_,) as nom::branch::Alt<_, _, _>>::choice |
168 | | } |
169 | | |
170 | | macro_rules! permutation_trait( |
171 | | ( |
172 | | $name1:ident $ty1:ident $item1:ident |
173 | | $name2:ident $ty2:ident $item2:ident |
174 | | $($name3:ident $ty3:ident $item3:ident)* |
175 | | ) => ( |
176 | | permutation_trait!(__impl $name1 $ty1 $item1, $name2 $ty2 $item2; $($name3 $ty3 $item3)*); |
177 | | ); |
178 | | ( |
179 | | __impl $($name:ident $ty:ident $item:ident),+; |
180 | | $name1:ident $ty1:ident $item1:ident $($name2:ident $ty2:ident $item2:ident)* |
181 | | ) => ( |
182 | | permutation_trait_impl!($($name $ty $item),+); |
183 | | permutation_trait!(__impl $($name $ty $item),+ , $name1 $ty1 $item1; $($name2 $ty2 $item2)*); |
184 | | ); |
185 | | (__impl $($name:ident $ty:ident $item:ident),+;) => ( |
186 | | permutation_trait_impl!($($name $ty $item),+); |
187 | | ); |
188 | | ); |
189 | | |
190 | | macro_rules! permutation_trait_impl( |
191 | | ($($name:ident $ty:ident $item:ident),+) => ( |
192 | | impl< |
193 | | Input: Clone, $($ty),+ , Error: ParseError<Input>, |
194 | | $($name: Parser<Input, $ty, Error>),+ |
195 | | > Permutation<Input, ( $($ty),+ ), Error> for ( $($name),+ ) { |
196 | | |
197 | 0 | fn permutation(&mut self, mut input: Input) -> IResult<Input, ( $($ty),+ ), Error> { |
198 | 0 | let mut res = ($(Option::<$ty>::None),+); |
199 | | |
200 | | loop { |
201 | 0 | let mut err: Option<Error> = None; |
202 | 0 | permutation_trait_inner!(0, self, input, res, err, $($name)+); |
203 | | |
204 | | // If we reach here, every iterator has either been applied before, |
205 | | // or errored on the remaining input |
206 | 0 | if let Some(err) = err { |
207 | | // There are remaining parsers, and all errored on the remaining input |
208 | 0 | return Err(Err::Error(Error::append(input, ErrorKind::Permutation, err))); |
209 | 0 | } |
210 | | |
211 | | // All parsers were applied |
212 | 0 | match res { |
213 | 0 | ($(Some($item)),+) => return Ok((input, ($($item),+))), |
214 | 0 | _ => unreachable!(), |
215 | | } |
216 | | } |
217 | 0 | } Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _) as nom::branch::Permutation<_, (_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _), _>>::permutation Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _) as nom::branch::Permutation<_, (_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _), _>>::permutation Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _) as nom::branch::Permutation<_, (_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _), _>>::permutation Unexecuted instantiation: <(_, _) as nom::branch::Permutation<_, (_, _), _>>::permutation Unexecuted instantiation: <(_, _, _) as nom::branch::Permutation<_, (_, _, _), _>>::permutation Unexecuted instantiation: <(_, _, _, _) as nom::branch::Permutation<_, (_, _, _, _), _>>::permutation Unexecuted instantiation: <(_, _, _, _, _) as nom::branch::Permutation<_, (_, _, _, _, _), _>>::permutation Unexecuted instantiation: <(_, _, _, _, _, _) as nom::branch::Permutation<_, (_, _, _, _, _, _), _>>::permutation Unexecuted instantiation: <(_, _, _, _, _, _, _) as nom::branch::Permutation<_, (_, _, _, _, _, _, _), _>>::permutation Unexecuted instantiation: <(_, _, _, _, _, _, _, _) as nom::branch::Permutation<_, (_, _, _, _, _, _, _, _), _>>::permutation Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _) as nom::branch::Permutation<_, (_, _, _, _, _, _, _, _, _), _>>::permutation Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _) as nom::branch::Permutation<_, (_, _, _, _, _, _, _, _, _, _), _>>::permutation Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _) as nom::branch::Permutation<_, (_, _, _, _, _, _, _, _, _, _, _), _>>::permutation Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _, _) as nom::branch::Permutation<_, (_, _, _, _, _, _, _, _, _, _, _, _), _>>::permutation Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _, _, _) as nom::branch::Permutation<_, (_, _, _, _, _, _, _, _, _, _, _, _, _), _>>::permutation Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _, _, _, _) as nom::branch::Permutation<_, (_, _, _, _, _, _, _, _, _, _, _, _, _, _), _>>::permutation Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _) as nom::branch::Permutation<_, (_, _, _, _, _, _, _, _, _, _, _, _, _, _, _), _>>::permutation Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _) as nom::branch::Permutation<_, (_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _), _>>::permutation Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _) as nom::branch::Permutation<_, (_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _), _>>::permutation Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _) as nom::branch::Permutation<_, (_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _), _>>::permutation Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _) as nom::branch::Permutation<_, (_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _), _>>::permutation Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _) as nom::branch::Permutation<_, (_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _), _>>::permutation Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _) as nom::branch::Permutation<_, (_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _), _>>::permutation Unexecuted instantiation: <(_, _) as nom::branch::Permutation<_, (_, _), _>>::permutation Unexecuted instantiation: <(_, _, _) as nom::branch::Permutation<_, (_, _, _), _>>::permutation Unexecuted instantiation: <(_, _, _, _) as nom::branch::Permutation<_, (_, _, _, _), _>>::permutation Unexecuted instantiation: <(_, _, _, _, _) as nom::branch::Permutation<_, (_, _, _, _, _), _>>::permutation Unexecuted instantiation: <(_, _, _, _, _, _) as nom::branch::Permutation<_, (_, _, _, _, _, _), _>>::permutation Unexecuted instantiation: <(_, _, _, _, _, _, _) as nom::branch::Permutation<_, (_, _, _, _, _, _, _), _>>::permutation Unexecuted instantiation: <(_, _, _, _, _, _, _, _) as nom::branch::Permutation<_, (_, _, _, _, _, _, _, _), _>>::permutation Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _) as nom::branch::Permutation<_, (_, _, _, _, _, _, _, _, _), _>>::permutation Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _) as nom::branch::Permutation<_, (_, _, _, _, _, _, _, _, _, _), _>>::permutation Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _) as nom::branch::Permutation<_, (_, _, _, _, _, _, _, _, _, _, _), _>>::permutation Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _, _) as nom::branch::Permutation<_, (_, _, _, _, _, _, _, _, _, _, _, _), _>>::permutation Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _, _, _) as nom::branch::Permutation<_, (_, _, _, _, _, _, _, _, _, _, _, _, _), _>>::permutation Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _, _, _, _) as nom::branch::Permutation<_, (_, _, _, _, _, _, _, _, _, _, _, _, _, _), _>>::permutation Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _) as nom::branch::Permutation<_, (_, _, _, _, _, _, _, _, _, _, _, _, _, _, _), _>>::permutation Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _) as nom::branch::Permutation<_, (_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _), _>>::permutation Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _) as nom::branch::Permutation<_, (_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _), _>>::permutation Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _) as nom::branch::Permutation<_, (_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _), _>>::permutation |
218 | | } |
219 | | ); |
220 | | ); |
221 | | |
222 | | macro_rules! permutation_trait_inner( |
223 | | ($it:tt, $self:expr, $input:ident, $res:expr, $err:expr, $head:ident $($id:ident)*) => ( |
224 | | if $res.$it.is_none() { |
225 | | match $self.$it.parse($input.clone()) { |
226 | | Ok((i, o)) => { |
227 | | $input = i; |
228 | | $res.$it = Some(o); |
229 | | continue; |
230 | | } |
231 | | Err(Err::Error(e)) => { |
232 | | $err = Some(match $err { |
233 | | Some(err) => err.or(e), |
234 | | None => e, |
235 | | }); |
236 | | } |
237 | | Err(e) => return Err(e), |
238 | | }; |
239 | | } |
240 | | succ!($it, permutation_trait_inner!($self, $input, $res, $err, $($id)*)); |
241 | | ); |
242 | | ($it:tt, $self:expr, $input:ident, $res:expr, $err:expr,) => (); |
243 | | ); |
244 | | |
245 | | permutation_trait!( |
246 | | FnA A a |
247 | | FnB B b |
248 | | FnC C c |
249 | | FnD D d |
250 | | FnE E e |
251 | | FnF F f |
252 | | FnG G g |
253 | | FnH H h |
254 | | FnI I i |
255 | | FnJ J j |
256 | | FnK K k |
257 | | FnL L l |
258 | | FnM M m |
259 | | FnN N n |
260 | | FnO O o |
261 | | FnP P p |
262 | | FnQ Q q |
263 | | FnR R r |
264 | | FnS S s |
265 | | FnT T t |
266 | | FnU U u |
267 | | ); |