/rust/registry/src/index.crates.io-1949cf8c6b5b557f/nom-8.0.0/src/sequence/mod.rs
Line | Count | Source |
1 | | //! Combinators applying parsers in sequence |
2 | | |
3 | | #[cfg(test)] |
4 | | mod tests; |
5 | | |
6 | | use crate::error::ParseError; |
7 | | use crate::internal::{IResult, Parser}; |
8 | | use crate::{Check, OutputM, OutputMode, PResult}; |
9 | | |
10 | | /// Gets an object from the first parser, |
11 | | /// then gets another object from the second parser. |
12 | | /// |
13 | | /// # Arguments |
14 | | /// * `first` The first parser to apply. |
15 | | /// * `second` The second parser to apply. |
16 | | /// |
17 | | /// # Example |
18 | | /// ```rust |
19 | | /// use nom::sequence::pair; |
20 | | /// use nom::bytes::complete::tag; |
21 | | /// use nom::{error::ErrorKind, Err, Parser}; |
22 | | /// |
23 | | /// let mut parser = pair(tag("abc"), tag("efg")); |
24 | | /// |
25 | | /// assert_eq!(parser.parse("abcefg"), Ok(("", ("abc", "efg")))); |
26 | | /// assert_eq!(parser.parse("abcefghij"), Ok(("hij", ("abc", "efg")))); |
27 | | /// assert_eq!(parser.parse(""), Err(Err::Error(("", ErrorKind::Tag)))); |
28 | | /// assert_eq!(parser.parse("123"), Err(Err::Error(("123", ErrorKind::Tag)))); |
29 | | /// ``` |
30 | 160k | pub fn pair<I, O1, O2, E: ParseError<I>, F, G>( |
31 | 160k | first: F, |
32 | 160k | second: G, |
33 | 160k | ) -> impl Parser<I, Output = (O1, O2), Error = E> |
34 | 160k | where |
35 | 160k | F: Parser<I, Output = O1, Error = E>, |
36 | 160k | G: Parser<I, Output = O2, Error = E>, |
37 | | { |
38 | 160k | first.and(second) |
39 | 160k | } Unexecuted instantiation: 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<nom::character::complete::digit1<&str, nom::error::Error<&str>>>>nom::sequence::pair::<&[u8], suricata::quic::frames::StreamTag, u32, suricata::quic::error::QuicError, suricata::quic::frames::parse_tag, nom::number::complete::le_u32<&[u8], suricata::quic::error::QuicError>> Line | Count | Source | 30 | 160k | pub fn pair<I, O1, O2, E: ParseError<I>, F, G>( | 31 | 160k | first: F, | 32 | 160k | second: G, | 33 | 160k | ) -> impl Parser<I, Output = (O1, O2), Error = E> | 34 | 160k | where | 35 | 160k | F: Parser<I, Output = O1, Error = E>, | 36 | 160k | G: Parser<I, Output = O2, Error = E>, | 37 | | { | 38 | 160k | first.and(second) | 39 | 160k | } |
Unexecuted instantiation: nom::sequence::pair::<_, _, _, _, _, _> |
40 | | |
41 | | /// Matches an object from the first parser and discards it, |
42 | | /// then gets an object from the second parser. |
43 | | /// |
44 | | /// # Arguments |
45 | | /// * `first` The opening parser. |
46 | | /// * `second` The second parser to get object. |
47 | | /// |
48 | | /// ```rust |
49 | | /// # use nom::{Err, error::ErrorKind, Needed, Parser}; |
50 | | /// # use nom::Needed::Size; |
51 | | /// use nom::sequence::preceded; |
52 | | /// use nom::bytes::complete::tag; |
53 | | /// |
54 | | /// let mut parser = preceded(tag("abc"), tag("efg")); |
55 | | /// |
56 | | /// assert_eq!(parser.parse("abcefg"), Ok(("", "efg"))); |
57 | | /// assert_eq!(parser.parse("abcefghij"), Ok(("hij", "efg"))); |
58 | | /// assert_eq!(parser.parse(""), Err(Err::Error(("", ErrorKind::Tag)))); |
59 | | /// assert_eq!(parser.parse("123"), Err(Err::Error(("123", ErrorKind::Tag)))); |
60 | | /// ``` |
61 | 3.50M | pub fn preceded<I, O, E: ParseError<I>, F, G>( |
62 | 3.50M | first: F, |
63 | 3.50M | second: G, |
64 | 3.50M | ) -> impl Parser<I, Output = O, Error = E> |
65 | 3.50M | where |
66 | 3.50M | F: Parser<I, Error = E>, |
67 | 3.50M | G: Parser<I, Output = O, Error = E>, |
68 | | { |
69 | 3.50M | Preceded { |
70 | 3.50M | f: first, |
71 | 3.50M | g: second, |
72 | 3.50M | } |
73 | 3.50M | } nom::sequence::preceded::<&[u8], char, nom::error::Error<&[u8]>, nom::bytes::streaming::take_while<suricata::sip::parser::hcolon::{closure#0}, &[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::sequence::Terminated<nom::character::streaming::char<&[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::bytes::streaming::take_while<suricata::sip::parser::hcolon::{closure#1}, &[u8], nom::error::Error<&[u8]>>::{closure#0}>>Line | Count | Source | 61 | 1.09M | pub fn preceded<I, O, E: ParseError<I>, F, G>( | 62 | 1.09M | first: F, | 63 | 1.09M | second: G, | 64 | 1.09M | ) -> impl Parser<I, Output = O, Error = E> | 65 | 1.09M | where | 66 | 1.09M | F: Parser<I, Error = E>, | 67 | 1.09M | G: Parser<I, Output = O, Error = E>, | 68 | | { | 69 | 1.09M | Preceded { | 70 | 1.09M | f: first, | 71 | 1.09M | g: second, | 72 | 1.09M | } | 73 | 1.09M | } |
Unexecuted instantiation: nom::sequence::preceded::<&str, &str, nom::error::Error<&str>, nom::character::complete::multispace0<&str, nom::error::Error<&str>>, nom::combinator::Verify<nom::character::complete::not_line_ending<&str, nom::error::Error<&str>>, suricata::conf::get_memval::{closure#0}, str>>Unexecuted instantiation: nom::sequence::preceded::<&str, f64, nom::error::Error<&str>, nom::character::complete::multispace0<&str, nom::error::Error<&str>>, nom::number::complete::double<&str, nom::error::Error<&str>>> nom::sequence::preceded::<&str, &str, suricata::detect::error::RuleParseError<&str>, nom::character::complete::multispace0<&str, suricata::detect::error::RuleParseError<&str>>, nom::bytes::complete::is_not<&str, &str, suricata::detect::error::RuleParseError<&str>>::{closure#0}>Line | Count | Source | 61 | 234k | pub fn preceded<I, O, E: ParseError<I>, F, G>( | 62 | 234k | first: F, | 63 | 234k | second: G, | 64 | 234k | ) -> impl Parser<I, Output = O, Error = E> | 65 | 234k | where | 66 | 234k | F: Parser<I, Error = E>, | 67 | 234k | G: Parser<I, Output = O, Error = E>, | 68 | | { | 69 | 234k | Preceded { | 70 | 234k | f: first, | 71 | 234k | g: second, | 72 | 234k | } | 73 | 234k | } |
nom::sequence::preceded::<&str, &str, nom::error::Error<&str>, nom::character::complete::multispace0<&str, nom::error::Error<&str>>, nom::bytes::complete::take_while<suricata::detect::requires::parse_key_value::{closure#0}, &str, nom::error::Error<&str>>::{closure#0}>Line | Count | Source | 61 | 55.0k | pub fn preceded<I, O, E: ParseError<I>, F, G>( | 62 | 55.0k | first: F, | 63 | 55.0k | second: G, | 64 | 55.0k | ) -> impl Parser<I, Output = O, Error = E> | 65 | 55.0k | where | 66 | 55.0k | F: Parser<I, Error = E>, | 67 | 55.0k | G: Parser<I, Output = O, Error = E>, | 68 | | { | 69 | 55.0k | Preceded { | 70 | 55.0k | f: first, | 71 | 55.0k | g: second, | 72 | 55.0k | } | 73 | 55.0k | } |
nom::sequence::preceded::<&str, &str, nom::error::Error<&str>, nom::character::complete::multispace0<&str, nom::error::Error<&str>>, nom::bytes::complete::tag<&str, &str, nom::error::Error<&str>>::{closure#0}>Line | Count | Source | 61 | 16.3k | pub fn preceded<I, O, E: ParseError<I>, F, G>( | 62 | 16.3k | first: F, | 63 | 16.3k | second: G, | 64 | 16.3k | ) -> impl Parser<I, Output = O, Error = E> | 65 | 16.3k | where | 66 | 16.3k | F: Parser<I, Error = E>, | 67 | 16.3k | G: Parser<I, Output = O, Error = E>, | 68 | | { | 69 | 16.3k | Preceded { | 70 | 16.3k | f: first, | 71 | 16.3k | g: second, | 72 | 16.3k | } | 73 | 16.3k | } |
nom::sequence::preceded::<&str, &str, nom::error::Error<&str>, nom::character::complete::multispace0<&str, nom::error::Error<&str>>, nom::bytes::complete::take_till<suricata::detect::requires::parse_key_value::{closure#1}, &str, nom::error::Error<&str>>::{closure#0}>Line | Count | Source | 61 | 55.0k | pub fn preceded<I, O, E: ParseError<I>, F, G>( | 62 | 55.0k | first: F, | 63 | 55.0k | second: G, | 64 | 55.0k | ) -> impl Parser<I, Output = O, Error = E> | 65 | 55.0k | where | 66 | 55.0k | F: Parser<I, Error = E>, | 67 | 55.0k | G: Parser<I, Output = O, Error = E>, | 68 | | { | 69 | 55.0k | Preceded { | 70 | 55.0k | f: first, | 71 | 55.0k | g: second, | 72 | 55.0k | } | 73 | 55.0k | } |
nom::sequence::preceded::<&str, suricata::detect::requires::VersionCompareOp, nom::error::Error<&str>, nom::character::complete::multispace0<&str, nom::error::Error<&str>>, nom::branch::Choice<(nom::internal::Map<nom::bytes::complete::tag<&str, &str, nom::error::Error<&str>>::{closure#0}, suricata::detect::requires::parse_op::{closure#0}>, nom::internal::Map<nom::bytes::complete::tag<&str, &str, nom::error::Error<&str>>::{closure#0}, suricata::detect::requires::parse_op::{closure#1}>, nom::internal::Map<nom::bytes::complete::tag<&str, &str, nom::error::Error<&str>>::{closure#0}, suricata::detect::requires::parse_op::{closure#2}>, nom::internal::Map<nom::bytes::complete::tag<&str, &str, nom::error::Error<&str>>::{closure#0}, suricata::detect::requires::parse_op::{closure#3}>)>>Line | Count | Source | 61 | 65.8k | pub fn preceded<I, O, E: ParseError<I>, F, G>( | 62 | 65.8k | first: F, | 63 | 65.8k | second: G, | 64 | 65.8k | ) -> impl Parser<I, Output = O, Error = E> | 65 | 65.8k | where | 66 | 65.8k | F: Parser<I, Error = E>, | 67 | 65.8k | G: Parser<I, Output = O, Error = E>, | 68 | | { | 69 | 65.8k | Preceded { | 70 | 65.8k | f: first, | 71 | 65.8k | g: second, | 72 | 65.8k | } | 73 | 65.8k | } |
nom::sequence::preceded::<&str, u8, nom::error::Error<&str>, nom::character::complete::multispace0<&str, nom::error::Error<&str>>, suricata::detect::requires::parse_next_version_part> Line | Count | Source | 61 | 63.4k | pub fn preceded<I, O, E: ParseError<I>, F, G>( | 62 | 63.4k | first: F, | 63 | 63.4k | second: G, | 64 | 63.4k | ) -> impl Parser<I, Output = O, Error = E> | 65 | 63.4k | where | 66 | 63.4k | F: Parser<I, Error = E>, | 67 | 63.4k | G: Parser<I, Output = O, Error = E>, | 68 | | { | 69 | 63.4k | Preceded { | 70 | 63.4k | f: first, | 71 | 63.4k | g: second, | 72 | 63.4k | } | 73 | 63.4k | } |
nom::sequence::preceded::<&str, u8, nom::error::Error<&str>, nom::character::complete::char<&str, nom::error::Error<&str>>::{closure#0}, suricata::detect::requires::parse_next_version_part>Line | Count | Source | 61 | 74.0k | pub fn preceded<I, O, E: ParseError<I>, F, G>( | 62 | 74.0k | first: F, | 63 | 74.0k | second: G, | 64 | 74.0k | ) -> impl Parser<I, Output = O, Error = E> | 65 | 74.0k | where | 66 | 74.0k | F: Parser<I, Error = E>, | 67 | 74.0k | G: Parser<I, Output = O, Error = E>, | 68 | | { | 69 | 74.0k | Preceded { | 70 | 74.0k | f: first, | 71 | 74.0k | g: second, | 72 | 74.0k | } | 73 | 74.0k | } |
nom::sequence::preceded::<&[u8], &[u8], nom::error::Error<&[u8]>, nom::character::complete::multispace0<&[u8], nom::error::Error<&[u8]>>, nom::sequence::Terminated<nom::character::complete::digit1<&[u8], nom::error::Error<&[u8]>>, nom::character::complete::multispace0<&[u8], nom::error::Error<&[u8]>>>> Line | Count | Source | 61 | 596k | pub fn preceded<I, O, E: ParseError<I>, F, G>( | 62 | 596k | first: F, | 63 | 596k | second: G, | 64 | 596k | ) -> impl Parser<I, Output = O, Error = E> | 65 | 596k | where | 66 | 596k | F: Parser<I, Error = E>, | 67 | 596k | G: Parser<I, Output = O, Error = E>, | 68 | | { | 69 | 596k | Preceded { | 70 | 596k | f: first, | 71 | 596k | g: second, | 72 | 596k | } | 73 | 596k | } |
nom::sequence::preceded::<&[u8], &str, nom::error::Error<&[u8]>, nom::character::complete::space1<&[u8], nom::error::Error<&[u8]>>, nom::internal::MapRes<nom::bytes::complete::take_while_m_n<suricata::sdp::parser::parse_media_description::{closure#4}, &[u8], nom::error::Error<&[u8]>>::{closure#0}, core::str::converts::from_utf8>>Line | Count | Source | 61 | 121k | pub fn preceded<I, O, E: ParseError<I>, F, G>( | 62 | 121k | first: F, | 63 | 121k | second: G, | 64 | 121k | ) -> impl Parser<I, Output = O, Error = E> | 65 | 121k | where | 66 | 121k | F: Parser<I, Error = E>, | 67 | 121k | G: Parser<I, Output = O, Error = E>, | 68 | | { | 69 | 121k | Preceded { | 70 | 121k | f: first, | 71 | 121k | g: second, | 72 | 121k | } | 73 | 121k | } |
nom::sequence::preceded::<&[u8], &str, nom::error::Error<&[u8]>, nom::bytes::complete::tag<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::internal::MapRes<nom::bytes::complete::take_till<suricata::sdp::parser::is_line_ending, &[u8], nom::error::Error<&[u8]>>::{closure#0}, core::str::converts::from_utf8>>Line | Count | Source | 61 | 270k | pub fn preceded<I, O, E: ParseError<I>, F, G>( | 62 | 270k | first: F, | 63 | 270k | second: G, | 64 | 270k | ) -> impl Parser<I, Output = O, Error = E> | 65 | 270k | where | 66 | 270k | F: Parser<I, Error = E>, | 67 | 270k | G: Parser<I, Output = O, Error = E>, | 68 | | { | 69 | 270k | Preceded { | 70 | 270k | f: first, | 71 | 270k | g: second, | 72 | 270k | } | 73 | 270k | } |
nom::sequence::preceded::<&[u8], &str, nom::error::Error<&[u8]>, nom::character::complete::char<&[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::internal::MapRes<nom::bytes::complete::take_while_m_n<suricata::sdp::parser::parse_media_description::{closure#2}, &[u8], nom::error::Error<&[u8]>>::{closure#0}, core::str::converts::from_utf8>>Line | Count | Source | 61 | 124k | pub fn preceded<I, O, E: ParseError<I>, F, G>( | 62 | 124k | first: F, | 63 | 124k | second: G, | 64 | 124k | ) -> impl Parser<I, Output = O, Error = E> | 65 | 124k | where | 66 | 124k | F: Parser<I, Error = E>, | 67 | 124k | G: Parser<I, Output = O, Error = E>, | 68 | | { | 69 | 124k | Preceded { | 70 | 124k | f: first, | 71 | 124k | g: second, | 72 | 124k | } | 73 | 124k | } |
nom::sequence::preceded::<&[u8], &str, nom::error::Error<&[u8]>, nom::character::complete::char<&[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::internal::MapRes<nom::bytes::complete::take_till<suricata::sdp::parser::is_line_ending, &[u8], nom::error::Error<&[u8]>>::{closure#0}, core::str::converts::from_utf8>>Line | Count | Source | 61 | 144k | pub fn preceded<I, O, E: ParseError<I>, F, G>( | 62 | 144k | first: F, | 63 | 144k | second: G, | 64 | 144k | ) -> impl Parser<I, Output = O, Error = E> | 65 | 144k | where | 66 | 144k | F: Parser<I, Error = E>, | 67 | 144k | G: Parser<I, Output = O, Error = E>, | 68 | | { | 69 | 144k | Preceded { | 70 | 144k | f: first, | 71 | 144k | g: second, | 72 | 144k | } | 73 | 144k | } |
nom::sequence::preceded::<&[u8], (&str, &[u8], &str, &[u8], &str, &[u8], &str), nom::error::Error<&[u8]>, nom::bytes::complete::tag<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}, (nom::internal::MapRes<nom::bytes::complete::take_while<suricata::sdp::parser::is_time_char, &[u8], nom::error::Error<&[u8]>>::{closure#0}, core::str::converts::from_utf8>, nom::character::complete::space1<&[u8], nom::error::Error<&[u8]>>, nom::internal::MapRes<nom::bytes::complete::take_while<suricata::sdp::parser::is_time_char, &[u8], nom::error::Error<&[u8]>>::{closure#0}, core::str::converts::from_utf8>, nom::character::complete::space1<&[u8], nom::error::Error<&[u8]>>, nom::internal::MapRes<nom::bytes::complete::take_while<suricata::sdp::parser::is_time_char, &[u8], nom::error::Error<&[u8]>>::{closure#0}, core::str::converts::from_utf8>, nom::character::complete::space1<&[u8], nom::error::Error<&[u8]>>, nom::internal::MapRes<nom::bytes::complete::take_while<suricata::sdp::parser::is_time_char, &[u8], nom::error::Error<&[u8]>>::{closure#0}, core::str::converts::from_utf8>)>Line | Count | Source | 61 | 92.8k | pub fn preceded<I, O, E: ParseError<I>, F, G>( | 62 | 92.8k | first: F, | 63 | 92.8k | second: G, | 64 | 92.8k | ) -> impl Parser<I, Output = O, Error = E> | 65 | 92.8k | where | 66 | 92.8k | F: Parser<I, Error = E>, | 67 | 92.8k | G: Parser<I, Output = O, Error = E>, | 68 | | { | 69 | 92.8k | Preceded { | 70 | 92.8k | f: first, | 71 | 92.8k | g: second, | 72 | 92.8k | } | 73 | 92.8k | } |
nom::sequence::preceded::<&[u8], (&str, &[u8], &str), nom::error::Error<&[u8]>, nom::bytes::complete::tag<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}, (nom::internal::MapRes<nom::character::complete::digit1<&[u8], nom::error::Error<&[u8]>>, core::str::converts::from_utf8>, nom::character::complete::space1<&[u8], nom::error::Error<&[u8]>>, nom::internal::MapRes<nom::character::complete::digit1<&[u8], nom::error::Error<&[u8]>>, core::str::converts::from_utf8>)>Line | Count | Source | 61 | 130k | pub fn preceded<I, O, E: ParseError<I>, F, G>( | 62 | 130k | first: F, | 63 | 130k | second: G, | 64 | 130k | ) -> impl Parser<I, Output = O, Error = E> | 65 | 130k | where | 66 | 130k | F: Parser<I, Error = E>, | 67 | 130k | G: Parser<I, Output = O, Error = E>, | 68 | | { | 69 | 130k | Preceded { | 70 | 130k | f: first, | 71 | 130k | g: second, | 72 | 130k | } | 73 | 130k | } |
nom::sequence::preceded::<&[u8], (&str, core::option::Option<&str>, &[u8]), nom::error::Error<&[u8]>, nom::bytes::complete::tag<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}, (nom::internal::MapRes<nom::bytes::complete::take_while<suricata::sdp::parser::parse_attributes::{closure#0}, &[u8], nom::error::Error<&[u8]>>::{closure#0}, core::str::converts::from_utf8>, nom::combinator::Opt<nom::sequence::Preceded<nom::character::complete::char<&[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::internal::MapRes<nom::bytes::complete::take_till<suricata::sdp::parser::is_line_ending, &[u8], nom::error::Error<&[u8]>>::{closure#0}, core::str::converts::from_utf8>>>, nom::character::complete::line_ending<&[u8], nom::error::Error<&[u8]>>)>Line | Count | Source | 61 | 144k | pub fn preceded<I, O, E: ParseError<I>, F, G>( | 62 | 144k | first: F, | 63 | 144k | second: G, | 64 | 144k | ) -> impl Parser<I, Output = O, Error = E> | 65 | 144k | where | 66 | 144k | F: Parser<I, Error = E>, | 67 | 144k | G: Parser<I, Output = O, Error = E>, | 68 | | { | 69 | 144k | Preceded { | 70 | 144k | f: first, | 71 | 144k | g: second, | 72 | 144k | } | 73 | 144k | } |
nom::sequence::preceded::<&[u8], (&str, char, &str, &[u8]), nom::error::Error<&[u8]>, nom::bytes::complete::tag<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}, (nom::internal::MapRes<nom::branch::Choice<(nom::bytes::complete::tag<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::bytes::complete::tag<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::bytes::complete::tag<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0})>, core::str::converts::from_utf8>, nom::character::complete::char<&[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::internal::MapRes<nom::character::complete::digit1<&[u8], nom::error::Error<&[u8]>>, core::str::converts::from_utf8>, nom::character::complete::line_ending<&[u8], nom::error::Error<&[u8]>>)>Line | Count | Source | 61 | 182k | pub fn preceded<I, O, E: ParseError<I>, F, G>( | 62 | 182k | first: F, | 63 | 182k | second: G, | 64 | 182k | ) -> impl Parser<I, Output = O, Error = E> | 65 | 182k | where | 66 | 182k | F: Parser<I, Error = E>, | 67 | 182k | G: Parser<I, Output = O, Error = E>, | 68 | | { | 69 | 182k | Preceded { | 70 | 182k | f: first, | 71 | 182k | g: second, | 72 | 182k | } | 73 | 182k | } |
nom::sequence::preceded::<&[u8], u8, nom::error::Error<&[u8]>, nom::combinator::Verify<nom::combinator::Peek<nom::number::complete::be_u8<&[u8], nom::error::Error<&[u8]>>>, suricata::sdp::parser::parse_num::{closure#0}, u8>, nom::character::complete::u8<&[u8], nom::error::Error<&[u8]>>>Line | Count | Source | 61 | 4.62k | pub fn preceded<I, O, E: ParseError<I>, F, G>( | 62 | 4.62k | first: F, | 63 | 4.62k | second: G, | 64 | 4.62k | ) -> impl Parser<I, Output = O, Error = E> | 65 | 4.62k | where | 66 | 4.62k | F: Parser<I, Error = E>, | 67 | 4.62k | G: Parser<I, Output = O, Error = E>, | 68 | | { | 69 | 4.62k | Preceded { | 70 | 4.62k | f: first, | 71 | 4.62k | g: second, | 72 | 4.62k | } | 73 | 4.62k | } |
nom::sequence::preceded::<&[u8], u8, nom::error::Error<&[u8]>, nom::character::complete::char<&[u8], nom::error::Error<&[u8]>>::{closure#0}, suricata::sdp::parser::parse_num>Line | Count | Source | 61 | 24.6k | pub fn preceded<I, O, E: ParseError<I>, F, G>( | 62 | 24.6k | first: F, | 63 | 24.6k | second: G, | 64 | 24.6k | ) -> impl Parser<I, Output = O, Error = E> | 65 | 24.6k | where | 66 | 24.6k | F: Parser<I, Error = E>, | 67 | 24.6k | G: Parser<I, Output = O, Error = E>, | 68 | | { | 69 | 24.6k | Preceded { | 70 | 24.6k | f: first, | 71 | 24.6k | g: second, | 72 | 24.6k | } | 73 | 24.6k | } |
nom::sequence::preceded::<&str, i32, nom::error::Error<&str>, nom::character::complete::multispace1<&str, nom::error::Error<&str>>, nom::combinator::Verify<suricata::asn1::parse_rules::parse_i32_number, suricata::asn1::parse_rules::asn1_parse_rule::relative_offset::{closure#0}, i32>>Line | Count | Source | 61 | 2.90k | pub fn preceded<I, O, E: ParseError<I>, F, G>( | 62 | 2.90k | first: F, | 63 | 2.90k | second: G, | 64 | 2.90k | ) -> impl Parser<I, Output = O, Error = E> | 65 | 2.90k | where | 66 | 2.90k | F: Parser<I, Error = E>, | 67 | 2.90k | G: Parser<I, Output = O, Error = E>, | 68 | | { | 69 | 2.90k | Preceded { | 70 | 2.90k | f: first, | 71 | 2.90k | g: second, | 72 | 2.90k | } | 73 | 2.90k | } |
nom::sequence::preceded::<&str, u32, nom::error::Error<&str>, nom::character::complete::multispace1<&str, nom::error::Error<&str>>, suricata::asn1::parse_rules::parse_u32_number> Line | Count | Source | 61 | 2.90k | pub fn preceded<I, O, E: ParseError<I>, F, G>( | 62 | 2.90k | first: F, | 63 | 2.90k | second: G, | 64 | 2.90k | ) -> impl Parser<I, Output = O, Error = E> | 65 | 2.90k | where | 66 | 2.90k | F: Parser<I, Error = E>, | 67 | 2.90k | G: Parser<I, Output = O, Error = E>, | 68 | | { | 69 | 2.90k | Preceded { | 70 | 2.90k | f: first, | 71 | 2.90k | g: second, | 72 | 2.90k | } | 73 | 2.90k | } |
nom::sequence::preceded::<&str, u16, nom::error::Error<&str>, nom::character::complete::multispace1<&str, nom::error::Error<&str>>, suricata::asn1::parse_rules::parse_u16_number> Line | Count | Source | 61 | 2.90k | pub fn preceded<I, O, E: ParseError<I>, F, G>( | 62 | 2.90k | first: F, | 63 | 2.90k | second: G, | 64 | 2.90k | ) -> impl Parser<I, Output = O, Error = E> | 65 | 2.90k | where | 66 | 2.90k | F: Parser<I, Error = E>, | 67 | 2.90k | G: Parser<I, Output = O, Error = E>, | 68 | | { | 69 | 2.90k | Preceded { | 70 | 2.90k | f: first, | 71 | 2.90k | g: second, | 72 | 2.90k | } | 73 | 2.90k | } |
Unexecuted instantiation: nom::sequence::preceded::<_, _, _, _, _> |
74 | | |
75 | | /// a |
76 | | pub struct Preceded<F, G> { |
77 | | f: F, |
78 | | g: G, |
79 | | } |
80 | | |
81 | | impl<I, E: ParseError<I>, F: Parser<I, Error = E>, G: Parser<I, Error = E>> Parser<I> |
82 | | for Preceded<F, G> |
83 | | { |
84 | | type Output = <G as Parser<I>>::Output; |
85 | | type Error = E; |
86 | | |
87 | | #[inline(always)] |
88 | 10.9M | fn process<OM: OutputMode>(&mut self, i: I) -> PResult<OM, I, Self::Output, Self::Error> { |
89 | 10.9M | let (i, _) = self |
90 | 10.9M | .f |
91 | 10.9M | .process::<OutputM<Check, OM::Error, OM::Incomplete>>(i)?; |
92 | 8.53M | let (i, o2) = self.g.process::<OM>(i)?; |
93 | | |
94 | 8.44M | Ok((i, o2)) |
95 | 10.9M | } <nom::sequence::Preceded<nom::bytes::streaming::take_while<suricata::sip::parser::hcolon::{closure#0}, &[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::sequence::Terminated<nom::character::streaming::char<&[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::bytes::streaming::take_while<suricata::sip::parser::hcolon::{closure#1}, &[u8], nom::error::Error<&[u8]>>::{closure#0}>> as nom::internal::Parser<&[u8]>>::process::<nom::internal::OutputM<nom::internal::Emit, nom::internal::Emit, nom::internal::Streaming>>Line | Count | Source | 88 | 1.09M | fn process<OM: OutputMode>(&mut self, i: I) -> PResult<OM, I, Self::Output, Self::Error> { | 89 | 1.09M | let (i, _) = self | 90 | 1.09M | .f | 91 | 1.09M | .process::<OutputM<Check, OM::Error, OM::Incomplete>>(i)?; | 92 | 1.09M | let (i, o2) = self.g.process::<OM>(i)?; | 93 | | | 94 | 1.08M | Ok((i, o2)) | 95 | 1.09M | } |
Unexecuted instantiation: <nom::sequence::Preceded<nom::character::complete::multispace0<&str, nom::error::Error<&str>>, nom::combinator::Verify<nom::character::complete::not_line_ending<&str, nom::error::Error<&str>>, suricata::conf::get_memval::{closure#0}, str>> as nom::internal::Parser<&str>>::process::<nom::internal::OutputM<nom::internal::Emit, nom::internal::Emit, nom::internal::Streaming>>Unexecuted instantiation: <nom::sequence::Preceded<nom::character::complete::multispace0<&str, nom::error::Error<&str>>, nom::number::complete::double<&str, nom::error::Error<&str>>> as nom::internal::Parser<&str>>::process::<nom::internal::OutputM<nom::internal::Emit, nom::internal::Emit, nom::internal::Streaming>> <nom::sequence::Preceded<nom::character::complete::multispace0<&str, nom::error::Error<&str>>, nom::branch::Choice<(nom::internal::Map<nom::bytes::complete::tag<&str, &str, nom::error::Error<&str>>::{closure#0}, suricata::detect::requires::parse_op::{closure#0}>, nom::internal::Map<nom::bytes::complete::tag<&str, &str, nom::error::Error<&str>>::{closure#0}, suricata::detect::requires::parse_op::{closure#1}>, nom::internal::Map<nom::bytes::complete::tag<&str, &str, nom::error::Error<&str>>::{closure#0}, suricata::detect::requires::parse_op::{closure#2}>, nom::internal::Map<nom::bytes::complete::tag<&str, &str, nom::error::Error<&str>>::{closure#0}, suricata::detect::requires::parse_op::{closure#3}>)>> as nom::internal::Parser<&str>>::process::<nom::internal::OutputM<nom::internal::Emit, nom::internal::Emit, nom::internal::Streaming>>Line | Count | Source | 88 | 65.8k | fn process<OM: OutputMode>(&mut self, i: I) -> PResult<OM, I, Self::Output, Self::Error> { | 89 | 65.8k | let (i, _) = self | 90 | 65.8k | .f | 91 | 65.8k | .process::<OutputM<Check, OM::Error, OM::Incomplete>>(i)?; | 92 | 65.8k | let (i, o2) = self.g.process::<OM>(i)?; | 93 | | | 94 | 41.4k | Ok((i, o2)) | 95 | 65.8k | } |
<nom::sequence::Preceded<nom::character::complete::multispace0<&str, nom::error::Error<&str>>, nom::bytes::complete::take_while<suricata::detect::requires::parse_key_value::{closure#0}, &str, nom::error::Error<&str>>::{closure#0}> as nom::internal::Parser<&str>>::process::<nom::internal::OutputM<nom::internal::Emit, nom::internal::Emit, nom::internal::Streaming>>Line | Count | Source | 88 | 55.0k | fn process<OM: OutputMode>(&mut self, i: I) -> PResult<OM, I, Self::Output, Self::Error> { | 89 | 55.0k | let (i, _) = self | 90 | 55.0k | .f | 91 | 55.0k | .process::<OutputM<Check, OM::Error, OM::Incomplete>>(i)?; | 92 | 55.0k | let (i, o2) = self.g.process::<OM>(i)?; | 93 | | | 94 | 55.0k | Ok((i, o2)) | 95 | 55.0k | } |
<nom::sequence::Preceded<nom::character::complete::multispace0<&str, nom::error::Error<&str>>, nom::bytes::complete::take_till<suricata::detect::requires::parse_key_value::{closure#1}, &str, nom::error::Error<&str>>::{closure#0}> as nom::internal::Parser<&str>>::process::<nom::internal::OutputM<nom::internal::Emit, nom::internal::Emit, nom::internal::Streaming>>Line | Count | Source | 88 | 55.0k | fn process<OM: OutputMode>(&mut self, i: I) -> PResult<OM, I, Self::Output, Self::Error> { | 89 | 55.0k | let (i, _) = self | 90 | 55.0k | .f | 91 | 55.0k | .process::<OutputM<Check, OM::Error, OM::Incomplete>>(i)?; | 92 | 55.0k | let (i, o2) = self.g.process::<OM>(i)?; | 93 | | | 94 | 55.0k | Ok((i, o2)) | 95 | 55.0k | } |
<nom::sequence::Preceded<nom::character::complete::multispace0<&str, nom::error::Error<&str>>, suricata::detect::requires::parse_next_version_part> as nom::internal::Parser<&str>>::process::<nom::internal::OutputM<nom::internal::Emit, nom::internal::Emit, nom::internal::Streaming>> Line | Count | Source | 88 | 63.4k | fn process<OM: OutputMode>(&mut self, i: I) -> PResult<OM, I, Self::Output, Self::Error> { | 89 | 63.4k | let (i, _) = self | 90 | 63.4k | .f | 91 | 63.4k | .process::<OutputM<Check, OM::Error, OM::Incomplete>>(i)?; | 92 | 63.4k | let (i, o2) = self.g.process::<OM>(i)?; | 93 | | | 94 | 61.0k | Ok((i, o2)) | 95 | 63.4k | } |
<nom::sequence::Preceded<nom::character::complete::char<&str, nom::error::Error<&str>>::{closure#0}, suricata::detect::requires::parse_next_version_part> as nom::internal::Parser<&str>>::process::<nom::internal::OutputM<nom::internal::Emit, nom::internal::Emit, nom::internal::Streaming>>Line | Count | Source | 88 | 74.0k | fn process<OM: OutputMode>(&mut self, i: I) -> PResult<OM, I, Self::Output, Self::Error> { | 89 | 74.0k | let (i, _) = self | 90 | 74.0k | .f | 91 | 74.0k | .process::<OutputM<Check, OM::Error, OM::Incomplete>>(i)?; | 92 | 73.1k | let (i, o2) = self.g.process::<OM>(i)?; | 93 | | | 94 | 71.6k | Ok((i, o2)) | 95 | 74.0k | } |
<nom::sequence::Preceded<nom::combinator::Verify<nom::combinator::Peek<nom::number::complete::be_u8<&[u8], nom::error::Error<&[u8]>>>, suricata::sdp::parser::parse_num::{closure#0}, u8>, nom::character::complete::u8<&[u8], nom::error::Error<&[u8]>>> as nom::internal::Parser<&[u8]>>::process::<nom::internal::OutputM<nom::internal::Emit, nom::internal::Emit, nom::internal::Streaming>>Line | Count | Source | 88 | 4.62k | fn process<OM: OutputMode>(&mut self, i: I) -> PResult<OM, I, Self::Output, Self::Error> { | 89 | 4.62k | let (i, _) = self | 90 | 4.62k | .f | 91 | 4.62k | .process::<OutputM<Check, OM::Error, OM::Incomplete>>(i)?; | 92 | 3.82k | let (i, o2) = self.g.process::<OM>(i)?; | 93 | | | 94 | 2.06k | Ok((i, o2)) | 95 | 4.62k | } |
<nom::sequence::Preceded<nom::character::complete::multispace0<&[u8], nom::error::Error<&[u8]>>, nom::sequence::Terminated<nom::character::complete::digit1<&[u8], nom::error::Error<&[u8]>>, nom::character::complete::multispace0<&[u8], nom::error::Error<&[u8]>>>> as nom::internal::Parser<&[u8]>>::process::<nom::internal::OutputM<nom::internal::Emit, nom::internal::Emit, nom::internal::Streaming>> Line | Count | Source | 88 | 596k | fn process<OM: OutputMode>(&mut self, i: I) -> PResult<OM, I, Self::Output, Self::Error> { | 89 | 596k | let (i, _) = self | 90 | 596k | .f | 91 | 596k | .process::<OutputM<Check, OM::Error, OM::Incomplete>>(i)?; | 92 | 596k | let (i, o2) = self.g.process::<OM>(i)?; | 93 | | | 94 | 582k | Ok((i, o2)) | 95 | 596k | } |
<nom::sequence::Preceded<nom::character::complete::multispace1<&str, nom::error::Error<&str>>, nom::combinator::Verify<suricata::asn1::parse_rules::parse_i32_number, suricata::asn1::parse_rules::asn1_parse_rule::relative_offset::{closure#0}, i32>> as nom::internal::Parser<&str>>::process::<nom::internal::OutputM<nom::internal::Emit, nom::internal::Emit, nom::internal::Streaming>>Line | Count | Source | 88 | 463 | fn process<OM: OutputMode>(&mut self, i: I) -> PResult<OM, I, Self::Output, Self::Error> { | 89 | 463 | let (i, _) = self | 90 | 463 | .f | 91 | 463 | .process::<OutputM<Check, OM::Error, OM::Incomplete>>(i)?; | 92 | 439 | let (i, o2) = self.g.process::<OM>(i)?; | 93 | | | 94 | 421 | Ok((i, o2)) | 95 | 463 | } |
<nom::sequence::Preceded<nom::character::complete::multispace1<&str, nom::error::Error<&str>>, suricata::asn1::parse_rules::parse_u16_number> as nom::internal::Parser<&str>>::process::<nom::internal::OutputM<nom::internal::Emit, nom::internal::Emit, nom::internal::Streaming>> Line | Count | Source | 88 | 581 | fn process<OM: OutputMode>(&mut self, i: I) -> PResult<OM, I, Self::Output, Self::Error> { | 89 | 581 | let (i, _) = self | 90 | 581 | .f | 91 | 581 | .process::<OutputM<Check, OM::Error, OM::Incomplete>>(i)?; | 92 | 571 | let (i, o2) = self.g.process::<OM>(i)?; | 93 | | | 94 | 561 | Ok((i, o2)) | 95 | 581 | } |
<nom::sequence::Preceded<nom::character::complete::multispace1<&str, nom::error::Error<&str>>, suricata::asn1::parse_rules::parse_u32_number> as nom::internal::Parser<&str>>::process::<nom::internal::OutputM<nom::internal::Emit, nom::internal::Emit, nom::internal::Streaming>> Line | Count | Source | 88 | 448 | fn process<OM: OutputMode>(&mut self, i: I) -> PResult<OM, I, Self::Output, Self::Error> { | 89 | 448 | let (i, _) = self | 90 | 448 | .f | 91 | 448 | .process::<OutputM<Check, OM::Error, OM::Incomplete>>(i)?; | 92 | 399 | let (i, o2) = self.g.process::<OM>(i)?; | 93 | | | 94 | 380 | Ok((i, o2)) | 95 | 448 | } |
<nom::sequence::Preceded<nom::bytes::complete::tag<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::internal::MapRes<nom::bytes::complete::take_till<suricata::sdp::parser::is_line_ending, &[u8], nom::error::Error<&[u8]>>::{closure#0}, core::str::converts::from_utf8>> as nom::internal::Parser<&[u8]>>::process::<nom::internal::OutputM<nom::internal::Emit, nom::internal::Emit, nom::internal::Streaming>>Line | Count | Source | 88 | 270k | fn process<OM: OutputMode>(&mut self, i: I) -> PResult<OM, I, Self::Output, Self::Error> { | 89 | 270k | let (i, _) = self | 90 | 270k | .f | 91 | 270k | .process::<OutputM<Check, OM::Error, OM::Incomplete>>(i)?; | 92 | 7.73k | let (i, o2) = self.g.process::<OM>(i)?; | 93 | | | 94 | 6.79k | Ok((i, o2)) | 95 | 270k | } |
<nom::sequence::Preceded<nom::bytes::complete::tag<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}, (nom::internal::MapRes<nom::character::complete::digit1<&[u8], nom::error::Error<&[u8]>>, core::str::converts::from_utf8>, nom::character::complete::space1<&[u8], nom::error::Error<&[u8]>>, nom::internal::MapRes<nom::character::complete::digit1<&[u8], nom::error::Error<&[u8]>>, core::str::converts::from_utf8>)> as nom::internal::Parser<&[u8]>>::process::<nom::internal::OutputM<nom::internal::Emit, nom::internal::Emit, nom::internal::Streaming>>Line | Count | Source | 88 | 130k | fn process<OM: OutputMode>(&mut self, i: I) -> PResult<OM, I, Self::Output, Self::Error> { | 89 | 130k | let (i, _) = self | 90 | 130k | .f | 91 | 130k | .process::<OutputM<Check, OM::Error, OM::Incomplete>>(i)?; | 92 | 70.1k | let (i, o2) = self.g.process::<OM>(i)?; | 93 | | | 94 | 68.1k | Ok((i, o2)) | 95 | 130k | } |
<nom::sequence::Preceded<nom::bytes::complete::tag<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}, (nom::internal::MapRes<nom::bytes::complete::take_while<suricata::sdp::parser::is_time_char, &[u8], nom::error::Error<&[u8]>>::{closure#0}, core::str::converts::from_utf8>, nom::character::complete::space1<&[u8], nom::error::Error<&[u8]>>, nom::internal::MapRes<nom::bytes::complete::take_while<suricata::sdp::parser::is_time_char, &[u8], nom::error::Error<&[u8]>>::{closure#0}, core::str::converts::from_utf8>, nom::character::complete::space1<&[u8], nom::error::Error<&[u8]>>, nom::internal::MapRes<nom::bytes::complete::take_while<suricata::sdp::parser::is_time_char, &[u8], nom::error::Error<&[u8]>>::{closure#0}, core::str::converts::from_utf8>, nom::character::complete::space1<&[u8], nom::error::Error<&[u8]>>, nom::internal::MapRes<nom::bytes::complete::take_while<suricata::sdp::parser::is_time_char, &[u8], nom::error::Error<&[u8]>>::{closure#0}, core::str::converts::from_utf8>)> as nom::internal::Parser<&[u8]>>::process::<nom::internal::OutputM<nom::internal::Emit, nom::internal::Emit, nom::internal::Streaming>>Line | Count | Source | 88 | 92.8k | fn process<OM: OutputMode>(&mut self, i: I) -> PResult<OM, I, Self::Output, Self::Error> { | 89 | 92.8k | let (i, _) = self | 90 | 92.8k | .f | 91 | 92.8k | .process::<OutputM<Check, OM::Error, OM::Incomplete>>(i)?; | 92 | 22.1k | let (i, o2) = self.g.process::<OM>(i)?; | 93 | | | 94 | 20.3k | Ok((i, o2)) | 95 | 92.8k | } |
<nom::sequence::Preceded<nom::character::complete::char<&[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::internal::MapRes<nom::bytes::complete::take_while_m_n<suricata::sdp::parser::parse_media_description::{closure#2}, &[u8], nom::error::Error<&[u8]>>::{closure#0}, core::str::converts::from_utf8>> as nom::internal::Parser<&[u8]>>::process::<nom::internal::OutputM<nom::internal::Emit, nom::internal::Check, nom::internal::Streaming>>Line | Count | Source | 88 | 124k | fn process<OM: OutputMode>(&mut self, i: I) -> PResult<OM, I, Self::Output, Self::Error> { | 89 | 124k | let (i, _) = self | 90 | 124k | .f | 91 | 124k | .process::<OutputM<Check, OM::Error, OM::Incomplete>>(i)?; | 92 | 4.55k | let (i, o2) = self.g.process::<OM>(i)?; | 93 | | | 94 | 4.02k | Ok((i, o2)) | 95 | 124k | } |
<nom::sequence::Preceded<nom::character::complete::char<&[u8], nom::error::Error<&[u8]>>::{closure#0}, suricata::sdp::parser::parse_num> as nom::internal::Parser<&[u8]>>::process::<nom::internal::OutputM<nom::internal::Emit, nom::internal::Check, nom::internal::Streaming>>Line | Count | Source | 88 | 24.6k | fn process<OM: OutputMode>(&mut self, i: I) -> PResult<OM, I, Self::Output, Self::Error> { | 89 | 24.6k | let (i, _) = self | 90 | 24.6k | .f | 91 | 24.6k | .process::<OutputM<Check, OM::Error, OM::Incomplete>>(i)?; | 92 | 4.62k | let (i, o2) = self.g.process::<OM>(i)?; | 93 | | | 94 | 2.06k | Ok((i, o2)) | 95 | 24.6k | } |
<nom::sequence::Preceded<nom::character::complete::multispace0<&str, nom::error::Error<&str>>, nom::bytes::complete::tag<&str, &str, nom::error::Error<&str>>::{closure#0}> as nom::internal::Parser<&str>>::process::<nom::internal::OutputM<nom::internal::Check, nom::internal::Check, nom::internal::Streaming>>Line | Count | Source | 88 | 25.3k | fn process<OM: OutputMode>(&mut self, i: I) -> PResult<OM, I, Self::Output, Self::Error> { | 89 | 25.3k | let (i, _) = self | 90 | 25.3k | .f | 91 | 25.3k | .process::<OutputM<Check, OM::Error, OM::Incomplete>>(i)?; | 92 | 25.3k | let (i, o2) = self.g.process::<OM>(i)?; | 93 | | | 94 | 12.8k | Ok((i, o2)) | 95 | 25.3k | } |
<nom::sequence::Preceded<nom::character::complete::multispace0<&str, suricata::detect::error::RuleParseError<&str>>, nom::bytes::complete::is_not<&str, &str, suricata::detect::error::RuleParseError<&str>>::{closure#0}> as nom::internal::Parser<&str>>::process::<nom::internal::OutputM<nom::internal::Emit, nom::internal::Check, nom::internal::Streaming>>Line | Count | Source | 88 | 455k | fn process<OM: OutputMode>(&mut self, i: I) -> PResult<OM, I, Self::Output, Self::Error> { | 89 | 455k | let (i, _) = self | 90 | 455k | .f | 91 | 455k | .process::<OutputM<Check, OM::Error, OM::Incomplete>>(i)?; | 92 | 455k | let (i, o2) = self.g.process::<OM>(i)?; | 93 | | | 94 | 454k | Ok((i, o2)) | 95 | 455k | } |
<nom::sequence::Preceded<nom::character::complete::space1<&[u8], nom::error::Error<&[u8]>>, nom::internal::MapRes<nom::bytes::complete::take_while_m_n<suricata::sdp::parser::parse_media_description::{closure#4}, &[u8], nom::error::Error<&[u8]>>::{closure#0}, core::str::converts::from_utf8>> as nom::internal::Parser<&[u8]>>::process::<nom::internal::OutputM<nom::internal::Emit, nom::internal::Emit, nom::internal::Streaming>>Line | Count | Source | 88 | 121k | fn process<OM: OutputMode>(&mut self, i: I) -> PResult<OM, I, Self::Output, Self::Error> { | 89 | 121k | let (i, _) = self | 90 | 121k | .f | 91 | 121k | .process::<OutputM<Check, OM::Error, OM::Incomplete>>(i)?; | 92 | 121k | let (i, o2) = self.g.process::<OM>(i)?; | 93 | | | 94 | 120k | Ok((i, o2)) | 95 | 121k | } |
<nom::sequence::Preceded<nom::character::complete::space1<&[u8], nom::error::Error<&[u8]>>, nom::internal::MapRes<nom::bytes::complete::take_while_m_n<suricata::sdp::parser::parse_media_description::{closure#4}, &[u8], nom::error::Error<&[u8]>>::{closure#0}, core::str::converts::from_utf8>> as nom::internal::Parser<&[u8]>>::process::<nom::internal::OutputM<nom::internal::Emit, nom::internal::Check, nom::internal::Streaming>>Line | Count | Source | 88 | 3.33M | fn process<OM: OutputMode>(&mut self, i: I) -> PResult<OM, I, Self::Output, Self::Error> { | 89 | 3.33M | let (i, _) = self | 90 | 3.33M | .f | 91 | 3.33M | .process::<OutputM<Check, OM::Error, OM::Incomplete>>(i)?; | 92 | 3.21M | let (i, o2) = self.g.process::<OM>(i)?; | 93 | | | 94 | 3.21M | Ok((i, o2)) | 95 | 3.33M | } |
<nom::sequence::Preceded<nom::bytes::complete::tag<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}, (nom::internal::MapRes<nom::branch::Choice<(nom::bytes::complete::tag<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::bytes::complete::tag<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::bytes::complete::tag<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0})>, core::str::converts::from_utf8>, nom::character::complete::char<&[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::internal::MapRes<nom::character::complete::digit1<&[u8], nom::error::Error<&[u8]>>, core::str::converts::from_utf8>, nom::character::complete::line_ending<&[u8], nom::error::Error<&[u8]>>)> as nom::internal::Parser<&[u8]>>::process::<nom::internal::OutputM<nom::internal::Emit, nom::internal::Check, nom::internal::Streaming>>Line | Count | Source | 88 | 599k | fn process<OM: OutputMode>(&mut self, i: I) -> PResult<OM, I, Self::Output, Self::Error> { | 89 | 599k | let (i, _) = self | 90 | 599k | .f | 91 | 599k | .process::<OutputM<Check, OM::Error, OM::Incomplete>>(i)?; | 92 | 429k | let (i, o2) = self.g.process::<OM>(i)?; | 93 | | | 94 | 417k | Ok((i, o2)) | 95 | 599k | } |
<nom::sequence::Preceded<nom::bytes::complete::tag<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}, (nom::internal::MapRes<nom::bytes::complete::take_while<suricata::sdp::parser::parse_attributes::{closure#0}, &[u8], nom::error::Error<&[u8]>>::{closure#0}, core::str::converts::from_utf8>, nom::combinator::Opt<nom::sequence::Preceded<nom::character::complete::char<&[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::internal::MapRes<nom::bytes::complete::take_till<suricata::sdp::parser::is_line_ending, &[u8], nom::error::Error<&[u8]>>::{closure#0}, core::str::converts::from_utf8>>>, nom::character::complete::line_ending<&[u8], nom::error::Error<&[u8]>>)> as nom::internal::Parser<&[u8]>>::process::<nom::internal::OutputM<nom::internal::Emit, nom::internal::Check, nom::internal::Streaming>>Line | Count | Source | 88 | 1.81M | fn process<OM: OutputMode>(&mut self, i: I) -> PResult<OM, I, Self::Output, Self::Error> { | 89 | 1.81M | let (i, _) = self | 90 | 1.81M | .f | 91 | 1.81M | .process::<OutputM<Check, OM::Error, OM::Incomplete>>(i)?; | 92 | 1.67M | let (i, o2) = self.g.process::<OM>(i)?; | 93 | | | 94 | 1.66M | Ok((i, o2)) | 95 | 1.81M | } |
<nom::sequence::Preceded<nom::character::complete::char<&[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::internal::MapRes<nom::bytes::complete::take_till<suricata::sdp::parser::is_line_ending, &[u8], nom::error::Error<&[u8]>>::{closure#0}, core::str::converts::from_utf8>> as nom::internal::Parser<&[u8]>>::process::<nom::internal::OutputM<nom::internal::Emit, nom::internal::Check, nom::internal::Streaming>>Line | Count | Source | 88 | 1.67M | fn process<OM: OutputMode>(&mut self, i: I) -> PResult<OM, I, Self::Output, Self::Error> { | 89 | 1.67M | let (i, _) = self | 90 | 1.67M | .f | 91 | 1.67M | .process::<OutputM<Check, OM::Error, OM::Incomplete>>(i)?; | 92 | 265k | let (i, o2) = self.g.process::<OM>(i)?; | 93 | | | 94 | 264k | Ok((i, o2)) | 95 | 1.67M | } |
<nom::sequence::Preceded<nom::character::complete::multispace0<&str, suricata::detect::error::RuleParseError<&str>>, nom::bytes::complete::is_not<&str, &str, suricata::detect::error::RuleParseError<&str>>::{closure#0}> as nom::internal::Parser<&str>>::process::<nom::internal::OutputM<nom::internal::Emit, nom::internal::Emit, nom::internal::Streaming>>Line | Count | Source | 88 | 234k | fn process<OM: OutputMode>(&mut self, i: I) -> PResult<OM, I, Self::Output, Self::Error> { | 89 | 234k | let (i, _) = self | 90 | 234k | .f | 91 | 234k | .process::<OutputM<Check, OM::Error, OM::Incomplete>>(i)?; | 92 | 234k | let (i, o2) = self.g.process::<OM>(i)?; | 93 | | | 94 | 234k | Ok((i, o2)) | 95 | 234k | } |
Unexecuted instantiation: <nom::sequence::Preceded<_, _> as nom::internal::Parser<_>>::process::<_> |
96 | | } |
97 | | |
98 | | /// Gets an object from the first parser, |
99 | | /// then matches an object from the second parser and discards it. |
100 | | /// |
101 | | /// # Arguments |
102 | | /// * `first` The first parser to apply. |
103 | | /// * `second` The second parser to match an object. |
104 | | /// |
105 | | /// ```rust |
106 | | /// # use nom::{Err, error::ErrorKind, Needed, Parser}; |
107 | | /// # use nom::Needed::Size; |
108 | | /// use nom::sequence::terminated; |
109 | | /// use nom::bytes::complete::tag; |
110 | | /// |
111 | | /// let mut parser = terminated(tag("abc"), tag("efg")); |
112 | | /// |
113 | | /// assert_eq!(parser.parse("abcefg"), Ok(("", "abc"))); |
114 | | /// assert_eq!(parser.parse("abcefghij"), Ok(("hij", "abc"))); |
115 | | /// assert_eq!(parser.parse(""), Err(Err::Error(("", ErrorKind::Tag)))); |
116 | | /// assert_eq!(parser.parse("123"), Err(Err::Error(("123", ErrorKind::Tag)))); |
117 | | /// ``` |
118 | 1.84M | pub fn terminated<I, O, E: ParseError<I>, F, G>( |
119 | 1.84M | first: F, |
120 | 1.84M | second: G, |
121 | 1.84M | ) -> impl Parser<I, Output = O, Error = E> |
122 | 1.84M | where |
123 | 1.84M | F: Parser<I, Output = O, Error = E>, |
124 | 1.84M | G: Parser<I, Error = E>, |
125 | | { |
126 | 1.84M | Terminated { |
127 | 1.84M | f: first, |
128 | 1.84M | g: second, |
129 | 1.84M | } |
130 | 1.84M | } nom::sequence::terminated::<&[u8], char, nom::error::Error<&[u8]>, nom::character::streaming::char<&[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::bytes::streaming::take_while<suricata::sip::parser::hcolon::{closure#1}, &[u8], nom::error::Error<&[u8]>>::{closure#0}>Line | Count | Source | 118 | 1.09M | pub fn terminated<I, O, E: ParseError<I>, F, G>( | 119 | 1.09M | first: F, | 120 | 1.09M | second: G, | 121 | 1.09M | ) -> impl Parser<I, Output = O, Error = E> | 122 | 1.09M | where | 123 | 1.09M | F: Parser<I, Output = O, Error = E>, | 124 | 1.09M | G: Parser<I, Error = E>, | 125 | | { | 126 | 1.09M | Terminated { | 127 | 1.09M | f: first, | 128 | 1.09M | g: second, | 129 | 1.09M | } | 130 | 1.09M | } |
nom::sequence::terminated::<&[u8], &[u8], suricata::pgsql::parser::PgsqlParseError<&[u8]>, nom::bytes::streaming::take<u32, &[u8], suricata::pgsql::parser::PgsqlParseError<&[u8]>>::{closure#0}, nom::combinator::eof<&[u8], suricata::pgsql::parser::PgsqlParseError<&[u8]>>>Line | Count | Source | 118 | 1.15k | pub fn terminated<I, O, E: ParseError<I>, F, G>( | 119 | 1.15k | first: F, | 120 | 1.15k | second: G, | 121 | 1.15k | ) -> impl Parser<I, Output = O, Error = E> | 122 | 1.15k | where | 123 | 1.15k | F: Parser<I, Output = O, Error = E>, | 124 | 1.15k | G: Parser<I, Error = E>, | 125 | | { | 126 | 1.15k | Terminated { | 127 | 1.15k | f: first, | 128 | 1.15k | g: second, | 129 | 1.15k | } | 130 | 1.15k | } |
nom::sequence::terminated::<&[u8], &[u8], (), nom::bytes::streaming::tag<&str, &[u8], ()>::{closure#0}, nom::bytes::streaming::tag<&[u8], &[u8], ()>::{closure#0}>Line | Count | Source | 118 | 90.1k | pub fn terminated<I, O, E: ParseError<I>, F, G>( | 119 | 90.1k | first: F, | 120 | 90.1k | second: G, | 121 | 90.1k | ) -> impl Parser<I, Output = O, Error = E> | 122 | 90.1k | where | 123 | 90.1k | F: Parser<I, Output = O, Error = E>, | 124 | 90.1k | G: Parser<I, Error = E>, | 125 | | { | 126 | 90.1k | Terminated { | 127 | 90.1k | f: first, | 128 | 90.1k | g: second, | 129 | 90.1k | } | 130 | 90.1k | } |
nom::sequence::terminated::<&[u8], alloc::vec::Vec<suricata::pgsql::parser::PgsqlParameter>, suricata::pgsql::parser::PgsqlParseError<&[u8]>, nom::multi::Many1<suricata::pgsql::parser::pgsql_parse_generic_parameter>, nom::bytes::streaming::tag<&[u8], &[u8], suricata::pgsql::parser::PgsqlParseError<&[u8]>>::{closure#0}>Line | Count | Source | 118 | 15.6k | pub fn terminated<I, O, E: ParseError<I>, F, G>( | 119 | 15.6k | first: F, | 120 | 15.6k | second: G, | 121 | 15.6k | ) -> impl Parser<I, Output = O, Error = E> | 122 | 15.6k | where | 123 | 15.6k | F: Parser<I, Output = O, Error = E>, | 124 | 15.6k | G: Parser<I, Error = E>, | 125 | | { | 126 | 15.6k | Terminated { | 127 | 15.6k | f: first, | 128 | 15.6k | g: second, | 129 | 15.6k | } | 130 | 15.6k | } |
nom::sequence::terminated::<&[u8], alloc::vec::Vec<suricata::pgsql::parser::SASLAuthenticationMechanism>, suricata::pgsql::parser::PgsqlParseError<&[u8]>, nom::multi::Many1<suricata::pgsql::parser::parse_sasl_mechanism>, nom::bytes::streaming::tag<&[u8], &[u8], suricata::pgsql::parser::PgsqlParseError<&[u8]>>::{closure#0}>Line | Count | Source | 118 | 2.98k | pub fn terminated<I, O, E: ParseError<I>, F, G>( | 119 | 2.98k | first: F, | 120 | 2.98k | second: G, | 121 | 2.98k | ) -> impl Parser<I, Output = O, Error = E> | 122 | 2.98k | where | 123 | 2.98k | F: Parser<I, Output = O, Error = E>, | 124 | 2.98k | G: Parser<I, Error = E>, | 125 | | { | 126 | 2.98k | Terminated { | 127 | 2.98k | f: first, | 128 | 2.98k | g: second, | 129 | 2.98k | } | 130 | 2.98k | } |
nom::sequence::terminated::<&[u8], &[u8], nom::error::Error<&[u8]>, nom::bytes::streaming::take_while<suricata::ssh::parser::is_not_lineend, &[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::branch::Choice<(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 | 118 | 31.9k | pub fn terminated<I, O, E: ParseError<I>, F, G>( | 119 | 31.9k | first: F, | 120 | 31.9k | second: G, | 121 | 31.9k | ) -> impl Parser<I, Output = O, Error = E> | 122 | 31.9k | where | 123 | 31.9k | F: Parser<I, Output = O, Error = E>, | 124 | 31.9k | G: Parser<I, Error = E>, | 125 | | { | 126 | 31.9k | Terminated { | 127 | 31.9k | f: first, | 128 | 31.9k | g: second, | 129 | 31.9k | } | 130 | 31.9k | } |
nom::sequence::terminated::<&[u8], &[u8], nom::error::Error<&[u8]>, nom::bytes::complete::take_while1<suricata::applayertemplate::template::probe::{closure#0}, &[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::bytes::complete::tag<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}>Line | Count | Source | 118 | 10.9k | pub fn terminated<I, O, E: ParseError<I>, F, G>( | 119 | 10.9k | first: F, | 120 | 10.9k | second: G, | 121 | 10.9k | ) -> impl Parser<I, Output = O, Error = E> | 122 | 10.9k | where | 123 | 10.9k | F: Parser<I, Output = O, Error = E>, | 124 | 10.9k | G: Parser<I, Error = E>, | 125 | | { | 126 | 10.9k | Terminated { | 127 | 10.9k | f: first, | 128 | 10.9k | g: second, | 129 | 10.9k | } | 130 | 10.9k | } |
nom::sequence::terminated::<&[u8], &[u8], nom::error::Error<&[u8]>, nom::character::complete::digit1<&[u8], nom::error::Error<&[u8]>>, nom::character::complete::multispace0<&[u8], nom::error::Error<&[u8]>>> Line | Count | Source | 118 | 596k | pub fn terminated<I, O, E: ParseError<I>, F, G>( | 119 | 596k | first: F, | 120 | 596k | second: G, | 121 | 596k | ) -> impl Parser<I, Output = O, Error = E> | 122 | 596k | where | 123 | 596k | F: Parser<I, Output = O, Error = E>, | 124 | 596k | G: Parser<I, Error = E>, | 125 | | { | 126 | 596k | Terminated { | 127 | 596k | f: first, | 128 | 596k | g: second, | 129 | 596k | } | 130 | 596k | } |
Unexecuted instantiation: nom::sequence::terminated::<_, _, _, _, _> |
131 | | |
132 | | /// a |
133 | | pub struct Terminated<F, G> { |
134 | | f: F, |
135 | | g: G, |
136 | | } |
137 | | |
138 | | impl<I, E: ParseError<I>, F: Parser<I, Error = E>, G: Parser<I, Error = E>> Parser<I> |
139 | | for Terminated<F, G> |
140 | | { |
141 | | type Output = <F as Parser<I>>::Output; |
142 | | type Error = E; |
143 | | |
144 | | #[inline(always)] |
145 | 1.84M | fn process<OM: OutputMode>(&mut self, i: I) -> PResult<OM, I, Self::Output, Self::Error> { |
146 | 1.84M | let (i, o1) = self.f.process::<OM>(i)?; |
147 | 1.71M | let (i, _) = self |
148 | 1.71M | .g |
149 | 1.71M | .process::<OutputM<Check, OM::Error, OM::Incomplete>>(i)?; |
150 | | |
151 | 1.70M | Ok((i, o1)) |
152 | 1.84M | } <nom::sequence::Terminated<nom::character::streaming::char<&[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::bytes::streaming::take_while<suricata::sip::parser::hcolon::{closure#1}, &[u8], nom::error::Error<&[u8]>>::{closure#0}> as nom::internal::Parser<&[u8]>>::process::<nom::internal::OutputM<nom::internal::Emit, nom::internal::Emit, nom::internal::Streaming>>Line | Count | Source | 145 | 1.09M | fn process<OM: OutputMode>(&mut self, i: I) -> PResult<OM, I, Self::Output, Self::Error> { | 146 | 1.09M | let (i, o1) = self.f.process::<OM>(i)?; | 147 | 1.09M | let (i, _) = self | 148 | 1.09M | .g | 149 | 1.09M | .process::<OutputM<Check, OM::Error, OM::Incomplete>>(i)?; | 150 | | | 151 | 1.08M | Ok((i, o1)) | 152 | 1.09M | } |
<nom::sequence::Terminated<nom::multi::Many1<suricata::pgsql::parser::parse_sasl_mechanism>, nom::bytes::streaming::tag<&[u8], &[u8], suricata::pgsql::parser::PgsqlParseError<&[u8]>>::{closure#0}> as nom::internal::Parser<&[u8]>>::process::<nom::internal::OutputM<nom::internal::Emit, nom::internal::Emit, nom::internal::Streaming>>Line | Count | Source | 145 | 2.98k | fn process<OM: OutputMode>(&mut self, i: I) -> PResult<OM, I, Self::Output, Self::Error> { | 146 | 2.98k | let (i, o1) = self.f.process::<OM>(i)?; | 147 | 2.06k | let (i, _) = self | 148 | 2.06k | .g | 149 | 2.06k | .process::<OutputM<Check, OM::Error, OM::Incomplete>>(i)?; | 150 | | | 151 | 1.45k | Ok((i, o1)) | 152 | 2.98k | } |
<nom::sequence::Terminated<nom::multi::Many1<suricata::pgsql::parser::pgsql_parse_generic_parameter>, nom::bytes::streaming::tag<&[u8], &[u8], suricata::pgsql::parser::PgsqlParseError<&[u8]>>::{closure#0}> as nom::internal::Parser<&[u8]>>::process::<nom::internal::OutputM<nom::internal::Emit, nom::internal::Check, nom::internal::Streaming>>Line | Count | Source | 145 | 15.6k | fn process<OM: OutputMode>(&mut self, i: I) -> PResult<OM, I, Self::Output, Self::Error> { | 146 | 15.6k | let (i, o1) = self.f.process::<OM>(i)?; | 147 | 6.34k | let (i, _) = self | 148 | 6.34k | .g | 149 | 6.34k | .process::<OutputM<Check, OM::Error, OM::Incomplete>>(i)?; | 150 | | | 151 | 6.34k | Ok((i, o1)) | 152 | 15.6k | } |
<nom::sequence::Terminated<nom::bytes::streaming::tag<&str, &[u8], ()>::{closure#0}, nom::bytes::streaming::tag<&[u8], &[u8], ()>::{closure#0}> as nom::internal::Parser<&[u8]>>::process::<nom::internal::OutputM<nom::internal::Emit, nom::internal::Emit, nom::internal::Streaming>>Line | Count | Source | 145 | 90.1k | fn process<OM: OutputMode>(&mut self, i: I) -> PResult<OM, I, Self::Output, Self::Error> { | 146 | 90.1k | let (i, o1) = self.f.process::<OM>(i)?; | 147 | 5.33k | let (i, _) = self | 148 | 5.33k | .g | 149 | 5.33k | .process::<OutputM<Check, OM::Error, OM::Incomplete>>(i)?; | 150 | | | 151 | 4.92k | Ok((i, o1)) | 152 | 90.1k | } |
<nom::sequence::Terminated<nom::bytes::streaming::take<u32, &[u8], suricata::pgsql::parser::PgsqlParseError<&[u8]>>::{closure#0}, nom::combinator::eof<&[u8], suricata::pgsql::parser::PgsqlParseError<&[u8]>>> as nom::internal::Parser<&[u8]>>::process::<nom::internal::OutputM<nom::internal::Emit, nom::internal::Emit, nom::internal::Streaming>>Line | Count | Source | 145 | 1.15k | fn process<OM: OutputMode>(&mut self, i: I) -> PResult<OM, I, Self::Output, Self::Error> { | 146 | 1.15k | let (i, o1) = self.f.process::<OM>(i)?; | 147 | 785 | let (i, _) = self | 148 | 785 | .g | 149 | 785 | .process::<OutputM<Check, OM::Error, OM::Incomplete>>(i)?; | 150 | | | 151 | 554 | Ok((i, o1)) | 152 | 1.15k | } |
<nom::sequence::Terminated<nom::bytes::streaming::take_while<suricata::ssh::parser::is_not_lineend, &[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::branch::Choice<(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::internal::Parser<&[u8]>>::process::<nom::internal::OutputM<nom::internal::Emit, nom::internal::Emit, nom::internal::Streaming>>Line | Count | Source | 145 | 31.9k | fn process<OM: OutputMode>(&mut self, i: I) -> PResult<OM, I, Self::Output, Self::Error> { | 146 | 31.9k | let (i, o1) = self.f.process::<OM>(i)?; | 147 | 19.6k | let (i, _) = self | 148 | 19.6k | .g | 149 | 19.6k | .process::<OutputM<Check, OM::Error, OM::Incomplete>>(i)?; | 150 | | | 151 | 17.4k | Ok((i, o1)) | 152 | 31.9k | } |
<nom::sequence::Terminated<nom::bytes::complete::take_while1<suricata::applayertemplate::template::probe::{closure#0}, &[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::bytes::complete::tag<&str, &[u8], nom::error::Error<&[u8]>>::{closure#0}> as nom::internal::Parser<&[u8]>>::process::<nom::internal::OutputM<nom::internal::Emit, nom::internal::Emit, nom::internal::Streaming>>Line | Count | Source | 145 | 10.9k | fn process<OM: OutputMode>(&mut self, i: I) -> PResult<OM, I, Self::Output, Self::Error> { | 146 | 10.9k | let (i, o1) = self.f.process::<OM>(i)?; | 147 | 6.91k | let (i, _) = self | 148 | 6.91k | .g | 149 | 6.91k | .process::<OutputM<Check, OM::Error, OM::Incomplete>>(i)?; | 150 | | | 151 | 6.74k | Ok((i, o1)) | 152 | 10.9k | } |
<nom::sequence::Terminated<nom::character::complete::digit1<&[u8], nom::error::Error<&[u8]>>, nom::character::complete::multispace0<&[u8], nom::error::Error<&[u8]>>> as nom::internal::Parser<&[u8]>>::process::<nom::internal::OutputM<nom::internal::Emit, nom::internal::Emit, nom::internal::Streaming>> Line | Count | Source | 145 | 596k | fn process<OM: OutputMode>(&mut self, i: I) -> PResult<OM, I, Self::Output, Self::Error> { | 146 | 596k | let (i, o1) = self.f.process::<OM>(i)?; | 147 | 582k | let (i, _) = self | 148 | 582k | .g | 149 | 582k | .process::<OutputM<Check, OM::Error, OM::Incomplete>>(i)?; | 150 | | | 151 | 582k | Ok((i, o1)) | 152 | 596k | } |
Unexecuted instantiation: <nom::sequence::Terminated<_, _> as nom::internal::Parser<_>>::process::<_> |
153 | | } |
154 | | |
155 | | /// Gets an object from the first parser, |
156 | | /// then matches an object from the sep_parser and discards it, |
157 | | /// then gets another object from the second parser. |
158 | | /// |
159 | | /// # Arguments |
160 | | /// * `first` The first parser to apply. |
161 | | /// * `sep` The separator parser to apply. |
162 | | /// * `second` The second parser to apply. |
163 | | /// |
164 | | /// ```rust |
165 | | /// # use nom::{Err, error::ErrorKind, Needed, Parser}; |
166 | | /// # use nom::Needed::Size; |
167 | | /// use nom::sequence::separated_pair; |
168 | | /// use nom::bytes::complete::tag; |
169 | | /// |
170 | | /// let mut parser = separated_pair(tag("abc"), tag("|"), tag("efg")); |
171 | | /// |
172 | | /// assert_eq!(parser.parse("abc|efg"), Ok(("", ("abc", "efg")))); |
173 | | /// assert_eq!(parser.parse("abc|efghij"), Ok(("hij", ("abc", "efg")))); |
174 | | /// assert_eq!(parser.parse(""), Err(Err::Error(("", ErrorKind::Tag)))); |
175 | | /// assert_eq!(parser.parse("123"), Err(Err::Error(("123", ErrorKind::Tag)))); |
176 | | /// ``` |
177 | 8.70k | pub fn separated_pair<I, O1, O2, E: ParseError<I>, F, G, H>( |
178 | 8.70k | first: F, |
179 | 8.70k | sep: G, |
180 | 8.70k | second: H, |
181 | 8.70k | ) -> impl Parser<I, Output = (O1, O2), Error = E> |
182 | 8.70k | where |
183 | 8.70k | F: Parser<I, Output = O1, Error = E>, |
184 | 8.70k | G: Parser<I, Error = E>, |
185 | 8.70k | H: Parser<I, Output = O2, Error = E>, |
186 | | { |
187 | 8.70k | first.and(preceded(sep, second)) |
188 | 8.70k | } nom::sequence::separated_pair::<&str, &str, i32, nom::error::Error<&str>, nom::bytes::complete::tag<&str, &str, nom::error::Error<&str>>::{closure#0}, nom::character::complete::multispace1<&str, nom::error::Error<&str>>, nom::combinator::Verify<suricata::asn1::parse_rules::parse_i32_number, suricata::asn1::parse_rules::asn1_parse_rule::relative_offset::{closure#0}, i32>>Line | Count | Source | 177 | 2.90k | pub fn separated_pair<I, O1, O2, E: ParseError<I>, F, G, H>( | 178 | 2.90k | first: F, | 179 | 2.90k | sep: G, | 180 | 2.90k | second: H, | 181 | 2.90k | ) -> impl Parser<I, Output = (O1, O2), Error = E> | 182 | 2.90k | where | 183 | 2.90k | F: Parser<I, Output = O1, Error = E>, | 184 | 2.90k | G: Parser<I, Error = E>, | 185 | 2.90k | H: Parser<I, Output = O2, Error = E>, | 186 | | { | 187 | 2.90k | first.and(preceded(sep, second)) | 188 | 2.90k | } |
nom::sequence::separated_pair::<&str, &str, u32, nom::error::Error<&str>, nom::bytes::complete::tag<&str, &str, nom::error::Error<&str>>::{closure#0}, nom::character::complete::multispace1<&str, nom::error::Error<&str>>, suricata::asn1::parse_rules::parse_u32_number>Line | Count | Source | 177 | 2.90k | pub fn separated_pair<I, O1, O2, E: ParseError<I>, F, G, H>( | 178 | 2.90k | first: F, | 179 | 2.90k | sep: G, | 180 | 2.90k | second: H, | 181 | 2.90k | ) -> impl Parser<I, Output = (O1, O2), Error = E> | 182 | 2.90k | where | 183 | 2.90k | F: Parser<I, Output = O1, Error = E>, | 184 | 2.90k | G: Parser<I, Error = E>, | 185 | 2.90k | H: Parser<I, Output = O2, Error = E>, | 186 | | { | 187 | 2.90k | first.and(preceded(sep, second)) | 188 | 2.90k | } |
nom::sequence::separated_pair::<&str, &str, u16, nom::error::Error<&str>, nom::bytes::complete::tag<&str, &str, nom::error::Error<&str>>::{closure#0}, nom::character::complete::multispace1<&str, nom::error::Error<&str>>, suricata::asn1::parse_rules::parse_u16_number>Line | Count | Source | 177 | 2.90k | pub fn separated_pair<I, O1, O2, E: ParseError<I>, F, G, H>( | 178 | 2.90k | first: F, | 179 | 2.90k | sep: G, | 180 | 2.90k | second: H, | 181 | 2.90k | ) -> impl Parser<I, Output = (O1, O2), Error = E> | 182 | 2.90k | where | 183 | 2.90k | F: Parser<I, Output = O1, Error = E>, | 184 | 2.90k | G: Parser<I, Error = E>, | 185 | 2.90k | H: Parser<I, Output = O2, Error = E>, | 186 | | { | 187 | 2.90k | first.and(preceded(sep, second)) | 188 | 2.90k | } |
Unexecuted instantiation: nom::sequence::separated_pair::<_, _, _, _, _, _, _> |
189 | | |
190 | | /// Matches an object from the first parser and discards it, |
191 | | /// then gets an object from the second parser, |
192 | | /// and finally matches an object from the third parser and discards it. |
193 | | /// |
194 | | /// # Arguments |
195 | | /// * `first` The first parser to apply and discard. |
196 | | /// * `second` The second parser to apply. |
197 | | /// * `third` The third parser to apply and discard. |
198 | | /// |
199 | | /// ```rust |
200 | | /// # use nom::{Err, error::ErrorKind, Needed, Parser}; |
201 | | /// # use nom::Needed::Size; |
202 | | /// use nom::sequence::delimited; |
203 | | /// use nom::bytes::complete::tag; |
204 | | /// |
205 | | /// let mut parser = delimited(tag("("), tag("abc"), tag(")")); |
206 | | /// |
207 | | /// assert_eq!(parser.parse("(abc)"), Ok(("", "abc"))); |
208 | | /// assert_eq!(parser.parse("(abc)def"), Ok(("def", "abc"))); |
209 | | /// assert_eq!(parser.parse(""), Err(Err::Error(("", ErrorKind::Tag)))); |
210 | | /// assert_eq!(parser.parse("123"), Err(Err::Error(("123", ErrorKind::Tag)))); |
211 | | /// ``` |
212 | 1.68M | pub fn delimited<I, O, E: ParseError<I>, F, G, H>( |
213 | 1.68M | first: F, |
214 | 1.68M | second: G, |
215 | 1.68M | third: H, |
216 | 1.68M | ) -> impl Parser<I, Output = O, Error = E> |
217 | 1.68M | where |
218 | 1.68M | F: Parser<I, Error = E>, |
219 | 1.68M | G: Parser<I, Output = O, Error = E>, |
220 | 1.68M | H: Parser<I, Error = E>, |
221 | | { |
222 | 1.68M | preceded(first, terminated(second, third)) |
223 | 1.68M | } nom::sequence::delimited::<&[u8], char, nom::error::Error<&[u8]>, nom::bytes::streaming::take_while<suricata::sip::parser::hcolon::{closure#0}, &[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::character::streaming::char<&[u8], nom::error::Error<&[u8]>>::{closure#0}, nom::bytes::streaming::take_while<suricata::sip::parser::hcolon::{closure#1}, &[u8], nom::error::Error<&[u8]>>::{closure#0}>Line | Count | Source | 212 | 1.09M | pub fn delimited<I, O, E: ParseError<I>, F, G, H>( | 213 | 1.09M | first: F, | 214 | 1.09M | second: G, | 215 | 1.09M | third: H, | 216 | 1.09M | ) -> impl Parser<I, Output = O, Error = E> | 217 | 1.09M | where | 218 | 1.09M | F: Parser<I, Error = E>, | 219 | 1.09M | G: Parser<I, Output = O, Error = E>, | 220 | 1.09M | H: Parser<I, Error = E>, | 221 | | { | 222 | 1.09M | preceded(first, terminated(second, third)) | 223 | 1.09M | } |
nom::sequence::delimited::<&[u8], &[u8], nom::error::Error<&[u8]>, nom::character::complete::multispace0<&[u8], nom::error::Error<&[u8]>>, nom::character::complete::digit1<&[u8], nom::error::Error<&[u8]>>, nom::character::complete::multispace0<&[u8], nom::error::Error<&[u8]>>> Line | Count | Source | 212 | 596k | pub fn delimited<I, O, E: ParseError<I>, F, G, H>( | 213 | 596k | first: F, | 214 | 596k | second: G, | 215 | 596k | third: H, | 216 | 596k | ) -> impl Parser<I, Output = O, Error = E> | 217 | 596k | where | 218 | 596k | F: Parser<I, Error = E>, | 219 | 596k | G: Parser<I, Output = O, Error = E>, | 220 | 596k | H: Parser<I, Error = E>, | 221 | | { | 222 | 596k | preceded(first, terminated(second, third)) | 223 | 596k | } |
Unexecuted instantiation: nom::sequence::delimited::<_, _, _, _, _, _> |
224 | | |
225 | | /// Helper trait for the tuple combinator. |
226 | | /// |
227 | | /// This trait is implemented for tuples of parsers of up to 21 elements. |
228 | | #[deprecated(since = "8.0.0", note = "`Parser` is directly implemented for tuples")] |
229 | | #[allow(deprecated)] |
230 | | pub trait Tuple<I, O, E> { |
231 | | /// Parses the input and returns a tuple of results of each parser. |
232 | | fn parse_tuple(&mut self, input: I) -> IResult<I, O, E>; |
233 | | } |
234 | | |
235 | | #[allow(deprecated)] |
236 | | impl<Input, Output, Error: ParseError<Input>, F: Parser<Input, Output = Output, Error = Error>> |
237 | | Tuple<Input, (Output,), Error> for (F,) |
238 | | { |
239 | 0 | fn parse_tuple(&mut self, input: Input) -> IResult<Input, (Output,), Error> { |
240 | 0 | self.0.parse(input).map(|(i, o)| (i, (o,))) |
241 | 0 | } |
242 | | } |
243 | | |
244 | | macro_rules! tuple_trait( |
245 | | ($name1:ident $ty1:ident, $name2: ident $ty2:ident, $($name:ident $ty:ident),*) => ( |
246 | | tuple_trait!(__impl $name1 $ty1, $name2 $ty2; $($name $ty),*); |
247 | | ); |
248 | | (__impl $($name:ident $ty: ident),+; $name1:ident $ty1:ident, $($name2:ident $ty2:ident),*) => ( |
249 | | tuple_trait_impl!($($name $ty),+); |
250 | | tuple_trait!(__impl $($name $ty),+ , $name1 $ty1; $($name2 $ty2),*); |
251 | | ); |
252 | | (__impl $($name:ident $ty: ident),+; $name1:ident $ty1:ident) => ( |
253 | | tuple_trait_impl!($($name $ty),+); |
254 | | tuple_trait_impl!($($name $ty),+, $name1 $ty1); |
255 | | ); |
256 | | ); |
257 | | |
258 | | macro_rules! tuple_trait_impl( |
259 | | ($($name:ident $ty: ident),+) => ( |
260 | | #[allow(deprecated)] |
261 | | impl< |
262 | | Input: Clone, $($ty),+ , Error: ParseError<Input>, |
263 | | $($name: Parser<Input, Output = $ty, Error = Error>),+ |
264 | | > Tuple<Input, ( $($ty),+ ), Error> for ( $($name),+ ) { |
265 | 0 | fn parse_tuple(&mut self, input: Input) -> IResult<Input, ( $($ty),+ ), Error> { |
266 | 0 | tuple_trait_inner!(0, self, input, (), $($name)+) |
267 | | |
268 | 0 | } Unexecuted instantiation: <(_, _) as nom::sequence::Tuple<_, (_, _), _>>::parse_tuple Unexecuted instantiation: <(_, _, _) as nom::sequence::Tuple<_, (_, _, _), _>>::parse_tuple Unexecuted instantiation: <(_, _, _, _) as nom::sequence::Tuple<_, (_, _, _, _), _>>::parse_tuple Unexecuted instantiation: <(_, _, _, _, _) as nom::sequence::Tuple<_, (_, _, _, _, _), _>>::parse_tuple Unexecuted instantiation: <(_, _, _, _, _, _) as nom::sequence::Tuple<_, (_, _, _, _, _, _), _>>::parse_tuple Unexecuted instantiation: <(_, _, _, _, _, _, _) as nom::sequence::Tuple<_, (_, _, _, _, _, _, _), _>>::parse_tuple Unexecuted instantiation: <(_, _, _, _, _, _, _, _) as nom::sequence::Tuple<_, (_, _, _, _, _, _, _, _), _>>::parse_tuple Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _) as nom::sequence::Tuple<_, (_, _, _, _, _, _, _, _, _), _>>::parse_tuple Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _) as nom::sequence::Tuple<_, (_, _, _, _, _, _, _, _, _, _), _>>::parse_tuple Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _) as nom::sequence::Tuple<_, (_, _, _, _, _, _, _, _, _, _, _), _>>::parse_tuple Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _, _) as nom::sequence::Tuple<_, (_, _, _, _, _, _, _, _, _, _, _, _), _>>::parse_tuple Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _, _, _) as nom::sequence::Tuple<_, (_, _, _, _, _, _, _, _, _, _, _, _, _), _>>::parse_tuple Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _, _, _, _) as nom::sequence::Tuple<_, (_, _, _, _, _, _, _, _, _, _, _, _, _, _), _>>::parse_tuple Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _) as nom::sequence::Tuple<_, (_, _, _, _, _, _, _, _, _, _, _, _, _, _, _), _>>::parse_tuple Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _) as nom::sequence::Tuple<_, (_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _), _>>::parse_tuple Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _) as nom::sequence::Tuple<_, (_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _), _>>::parse_tuple Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _) as nom::sequence::Tuple<_, (_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _), _>>::parse_tuple Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _) as nom::sequence::Tuple<_, (_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _), _>>::parse_tuple Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _) as nom::sequence::Tuple<_, (_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _), _>>::parse_tuple Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _) as nom::sequence::Tuple<_, (_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _), _>>::parse_tuple |
269 | | } |
270 | | ); |
271 | | ); |
272 | | |
273 | | macro_rules! tuple_trait_inner( |
274 | | ($it:tt, $self:expr, $input:expr, (), $head:ident $($id:ident)+) => ({ |
275 | | let (i, o) = $self.$it.parse($input)?; |
276 | | |
277 | | succ!($it, tuple_trait_inner!($self, i, ( o ), $($id)+)) |
278 | | }); |
279 | | ($it:tt, $self:expr, $input:expr, ($($parsed:tt)*), $head:ident $($id:ident)+) => ({ |
280 | | let (i, o) = $self.$it.parse($input)?; |
281 | | |
282 | | succ!($it, tuple_trait_inner!($self, i, ($($parsed)* , o), $($id)+)) |
283 | | }); |
284 | | ($it:tt, $self:expr, $input:expr, ($($parsed:tt)*), $head:ident) => ({ |
285 | | let (i, o) = $self.$it.parse($input)?; |
286 | | |
287 | | Ok((i, ($($parsed)* , o))) |
288 | | }); |
289 | | ); |
290 | | |
291 | | tuple_trait!(FnA A, FnB B, FnC C, FnD D, FnE E, FnF F, FnG G, FnH H, FnI I, FnJ J, FnK K, FnL L, |
292 | | FnM M, FnN N, FnO O, FnP P, FnQ Q, FnR R, FnS S, FnT T, FnU U); |
293 | | |
294 | | // Special case: implement `Tuple` for `()`, the unit type. |
295 | | // This can come up in macros which accept a variable number of arguments. |
296 | | // Literally, `()` is an empty tuple, so it should simply parse nothing. |
297 | | #[allow(deprecated)] |
298 | | impl<I, E: ParseError<I>> Tuple<I, (), E> for () { |
299 | 0 | fn parse_tuple(&mut self, input: I) -> IResult<I, (), E> { |
300 | 0 | Ok((input, ())) |
301 | 0 | } |
302 | | } |
303 | | |
304 | | ///Applies a tuple of parsers one by one and returns their results as a tuple. |
305 | | ///There is a maximum of 21 parsers |
306 | | /// ```rust |
307 | | /// # use nom::{Err, error::ErrorKind}; |
308 | | /// use nom::sequence::tuple; |
309 | | /// use nom::character::complete::{alpha1, digit1}; |
310 | | /// let mut parser = tuple((alpha1, digit1, alpha1)); |
311 | | /// |
312 | | /// assert_eq!(parser("abc123def"), Ok(("", ("abc", "123", "def")))); |
313 | | /// assert_eq!(parser("123def"), Err(Err::Error(("123def", ErrorKind::Alpha)))); |
314 | | /// ``` |
315 | | #[deprecated(since = "8.0.0", note = "`Parser` is directly implemented for tuples")] |
316 | | #[allow(deprecated)] |
317 | 0 | pub fn tuple<I, O, E: ParseError<I>, List: Tuple<I, O, E>>( |
318 | 0 | mut l: List, |
319 | 0 | ) -> impl FnMut(I) -> IResult<I, O, E> { |
320 | 0 | move |i: I| l.parse_tuple(i) |
321 | 0 | } |