pub fn read_while_escaping(&mut self, predicate: fn(&char) -> bool) -> String {
        let mut s = String::from("");
        let mut escaped = false;
        loop {
            match self.peek() {
                None => return s,
                Some(c) => {
                    if escaped && c == ' ' {
                        escaped = false;
                        s.push(self.read().unwrap())
                    } else if c == '\\' {
                        escaped = true;
                        let _backslash = self.read().unwrap();
                    } else if predicate(&c) {
                        s.push(self.read().unwrap())
                    } else {
                        return s;
                    }
                }
            }
        }
    }
// only support escaped spaces for now
only support escaped spaces for now
only support escaped spaces for now
pub fn read_while_escaping(&mut self, predicate: fn(&char) -> bool) -> String {
        let mut s = String::from("");
        let mut escaped = false;
        loop {
            match self.peek() {
                None => return s,
                Some(c) => {
                    if escaped && c == ' ' {
                        escaped = false;
                        s.push(self.read().unwrap())
                    } else if c == '\\' {
                        escaped = true;
                        let _backslash = self.read().unwrap();
                    } else if predicate(&c) {
                        s.push(self.read().unwrap())
                    } else {
                        return s;
                    }
                }
            }
        }
    }
pub fn read_while_escaping ( & mut self , predicate : fn ( & char ) -> bool ) -> String { let mut s = String :: from ( " " ) ; let mut escaped = false ; loop { match self . peek ( ) { None => return s , Some ( c ) => { if escaped && c == ' ' { escaped = false ; s . push ( self . read ( ) . unwrap ( ) ) } else if c == '\\' { escaped = true ; let _backslash = self . read ( ) . unwrap ( ) ; } else if predicate ( & c ) { s . push ( self . read ( ) . unwrap ( ) ) } else { return s ; } } } } }
only support escaped spaces for now
only support escaped spaces for now
&mut self
predicate
fn(&char) -> bool
&mut self
predicate
fn(&char) -> bool