pub(crate) fn parse_list(input: &str) -> IResult<&str, &str, RuleParseError<&str>> {
    let mut depth = 0;
    let mut end = 0;
    if input.is_empty() {
        return Err(nom::Err::Error(RuleParseError::Nom(input, ErrorKind::Eof)));
    }
    for (i, c) in input.chars().enumerate() {
        if i == 0 && c != '[' {
            // Cheat a little, just return the next non-whitespace token.
            return take_until_whitespace(input);
        }
        end = i;
        match c {
            '[' => {
                depth += 1;
            }
            ']' => {
                depth -= 1;
            }
            _ => {}
        }
        if depth == 0 {
            break;
        }
    }
    Ok((&input[end + 1..], &input[0..end + 1]))
}
/// Parse a list like an address or port list.
///
/// This doesn't actually produce the elements of the list, but just the full string
/// encapsulating the list.
Parse a list like an address or port list.
This doesn't actually produce the elements of the list, but just the full string
encapsulating the list.
Parse a list like an address or port list . This doesn ' t actually produce the elements of the list but just the full string encapsulating the list .
pub(crate) fn parse_list(input: &str) -> IResult<&str, &str, RuleParseError<&str>> {
    let mut depth = 0;
    let mut end = 0;
    if input.is_empty() {
        return Err(nom::Err::Error(RuleParseError::Nom(input, ErrorKind::Eof)));
    }
    for (i, c) in input.chars().enumerate() {
        if i == 0 && c != '[' {
            // Cheat a little, just return the next non-whitespace token.
            return take_until_whitespace(input);
        }
        end = i;
        match c {
            '[' => {
                depth += 1;
            }
            ']' => {
                depth -= 1;
            }
            _ => {}
        }
        if depth == 0 {
            break;
        }
    }
    Ok((&input[end + 1..], &input[0..end + 1]))
}
pub ( crate ) fn parse_list ( input : & str ) -> IResult < & str , & str , RuleParseError < & str > > { let mut depth = 0 ; let mut end = 0 ; if input . is_empty ( ) { return Err ( nom :: Err :: Error ( RuleParseError :: Nom ( input , ErrorKind :: Eof ) ) ) ; } for ( i , c ) in input . chars ( ) . enumerate ( ) { if i == 0 && c != '[' { // Cheat a little, just return the next non-whitespace token. return take_until_whitespace ( input ) ; } end = i ; match c { '[' => { depth += 1 ; } ']' => { depth -= 1 ; } _ => { } } if depth == 0 { break ; } } Ok ( ( & input [ end + 1 .. ] , & input [ 0 .. end + 1 ] ) ) }
Parse a list like an address or port list.
Parse a list like an address or port list .
input
&str