fn tree_selector<'a, E>(input: &'a str) -> IResult<&'a str, TreeSelector<'a>, E>
where
    E: NomParseError<&'a str>,
{
    let esc = escaped(none_of(":/\\ \t\n"), '\\', one_of("* \t/:\\"));
    let (rest, node_segments) = separated_nonempty_list(tag("/"), &esc)(input)?;
    let (rest, property_segment) = if peek::<&str, _, E, _>(tag(":"))(rest).is_ok() {
        let (rest, _) = tag(":")(rest)?;
        let (rest, property) = verify(esc, |value: &str| !value.is_empty())(rest)?;
        (rest, Some(property))
    } else {
        (rest, None)
    };
    Ok((
        rest,
        TreeSelector {
            node: node_segments.into_iter().map(|value| value.into()).collect(),
            property: property_segment.map(|value| value.into()),
        },
    ))
}
/// Parses a tree selector, which is a node selector and an optional property selector.
Parses a tree selector, which is a node selector and an optional property selector.
Parses a tree selector which is a node selector and an optional property selector .
fn tree_selector<'a, E>(input: &'a str) -> IResult<&'a str, TreeSelector<'a>, E>
where
    E: NomParseError<&'a str>,
{
    let esc = escaped(none_of(":/\\ \t\n"), '\\', one_of("* \t/:\\"));
    let (rest, node_segments) = separated_nonempty_list(tag("/"), &esc)(input)?;
    let (rest, property_segment) = if peek::<&str, _, E, _>(tag(":"))(rest).is_ok() {
        let (rest, _) = tag(":")(rest)?;
        let (rest, property) = verify(esc, |value: &str| !value.is_empty())(rest)?;
        (rest, Some(property))
    } else {
        (rest, None)
    };
    Ok((
        rest,
        TreeSelector {
            node: node_segments.into_iter().map(|value| value.into()).collect(),
            property: property_segment.map(|value| value.into()),
        },
    ))
}
fn tree_selector < ' a , E > ( input : & ' a str ) -> IResult < & ' a str , TreeSelector < ' a > , E > where E : NomParseError < & ' a str > , { let esc = escaped ( none_of ( " \\ \t \n " ) , '\\' , one_of ( " \t \\ " ) ) ; let ( rest , node_segments ) = separated_nonempty_list ( tag ( " " ) , & esc ) ( input ) ? ; let ( rest , property_segment ) = if peek :: < & str , _ , E , _ > ( tag ( " " ) ) ( rest ) . is_ok ( ) { let ( rest , _ ) = tag ( " " ) ( rest ) ? ; let ( rest , property ) = verify ( esc , | value : & str | ! value . is_empty ( ) ) ( rest ) ? ; ( rest , Some ( property ) ) } else { ( rest , None ) } ; Ok ( ( rest , TreeSelector { node : node_segments . into_iter ( ) . map ( | value | value . into ( ) ) . collect ( ) , property : property_segment . map ( | value | value . into ( ) ) , } , ) ) }
Parses a tree selector, which is a node selector and an optional property selector.
Parses a tree selector which is a node selector and an optional property selector .
input
&'a str
input
&'a str