fn body_token<T>(input: T) -> IResult<T, T>
where
    T: nom::Slice<Range<usize>> + nom::Slice<RangeFrom<usize>> + nom::Slice<RangeTo<usize>>,
    T: nom::InputIter + nom::InputLength,
    <T as nom::InputIter>::Item: AsChar,
{
    let input_length = input.input_len();
    if input_length == 0 {
        return Err(Err::Incomplete(nom::Needed::Unknown));
    }

    for (idx, item) in input.iter_indices() {
        let item = item.as_char();
        if !is_body_token(item) {
            if idx == 0 {
                return Err(Err::Error(error_position!(
                    input,
                    nom::ErrorKind::AlphaNumeric
                )));
            } else {
                return Ok((input.slice(idx..), input.slice(0..idx)));
            }
        }
    }
    Ok((input.slice(input_length..), input))
}
/// Recognizes one or more body tokens
Recognizes one or more body tokens
Recognizes one or more body tokens
fn body_token<T>(input: T) -> IResult<T, T>
where
    T: nom::Slice<Range<usize>> + nom::Slice<RangeFrom<usize>> + nom::Slice<RangeTo<usize>>,
    T: nom::InputIter + nom::InputLength,
    <T as nom::InputIter>::Item: AsChar,
{
    let input_length = input.input_len();
    if input_length == 0 {
        return Err(Err::Incomplete(nom::Needed::Unknown));
    }
    for (idx, item) in input.iter_indices() {
        let item = item.as_char();
        if !is_body_token(item) {
            if idx == 0 {
                return Err(Err::Error(error_position!(
                    input,
                    nom::ErrorKind::AlphaNumeric
                )));
            } else {
                return Ok((input.slice(idx..), input.slice(0..idx)));
            }
        }
    }
    Ok((input.slice(input_length..), input))
}
fn body_token < T > ( input : T ) -> IResult < T , T > where T : nom :: Slice < Range < usize > > + nom :: Slice < RangeFrom < usize > > + nom :: Slice < RangeTo < usize > > , T : nom :: InputIter + nom :: InputLength , < T as nom :: InputIter > :: Item : AsChar , { let input_length = input . input_len ( ) ; if input_length == 0 { return Err ( Err :: Incomplete ( nom :: Needed :: Unknown ) ) ; } for ( idx , item ) in input . iter_indices ( ) { let item = item . as_char ( ) ; if ! is_body_token ( item ) { if idx == 0 { return Err ( Err :: Error ( error_position ! ( input nom ErrorKind AlphaNumeric ) ) ) ; } else { return Ok ( ( input . slice ( idx .. ) , input . slice ( 0 .. idx ) ) ) ; } } } Ok ( ( input . slice ( input_length .. ) , input ) ) }
Recognizes one or more body tokens
Recognizes one or more body tokens
input
T
input
T