fn split_words(source: &str) -> Vec<&str> {
    let mut words = vec![];
    let mut chars = source.chars().enumerate();
    let mut last = 0;

    while let Some((i, c)) = chars.next() {
        match c {
            ' ' | '\t' => {
                if last == i {
                    last += 1;
                } else {
                    words.push(&source[last..i]);
                    last = i + 1;
                }
            }
            '\'' | '"' => {
                argv::find_with_previous(
                    &mut chars,
                    |o| {
                        if let Some((_, c)) = o {
                            *c != '\\'
                        } else {
                            true
                        }
                    },
                    |(_, current)| *current == c,
                );
            }
            '\\' => {
                chars.next();
            }
            _ => {}
        }
    }

    if last < source.len() {
        words.push(&source[last..])
    }

    words
}
/// Split a line into its individual words.
Split a line into its individual words.
Split a line into its individual words .
fn split_words(source: &str) -> Vec<&str> {
    let mut words = vec![];
    let mut chars = source.chars().enumerate();
    let mut last = 0;
    while let Some((i, c)) = chars.next() {
        match c {
            ' ' | '\t' => {
                if last == i {
                    last += 1;
                } else {
                    words.push(&source[last..i]);
                    last = i + 1;
                }
            }
            '\'' | '"' => {
                argv::find_with_previous(
                    &mut chars,
                    |o| {
                        if let Some((_, c)) = o {
                            *c != '\\'
                        } else {
                            true
                        }
                    },
                    |(_, current)| *current == c,
                );
            }
            '\\' => {
                chars.next();
            }
            _ => {}
        }
    }
    if last < source.len() {
        words.push(&source[last..])
    }
    words
}
fn split_words ( source : & str ) -> Vec < & str > { let mut words = vec ! [ ] ; let mut chars = source . chars ( ) . enumerate ( ) ; let mut last = 0 ; while let Some ( ( i , c ) ) = chars . next ( ) { match c { ' ' | '\t' => { if last == i { last += 1 ; } else { words . push ( & source [ last .. i ] ) ; last = i + 1 ; } } '\'' | '"' => { argv :: find_with_previous ( & mut chars , | o | { if let Some ( ( _ , c ) ) = o { * c != '\\' } else { true } } , | ( _ , current ) | * current == c , ) ; } '\\' => { chars . next ( ) ; } _ => { } } } if last < source . len ( ) { words . push ( & source [ last .. ] ) } words }
Split a line into its individual words.
Split a line into its individual words .
source
&str