fn scan_octal_escape(&mut self) -> char {
        // We are allowed to unwrap here (precondition)
        let mut val = self.last.unwrap().to_digit(8).unwrap();

        if let Some(c) = self.curr.and_then(|c| c.to_digit(8)) {
            self.bump();
            val = val * 8 + c;
        }

        // only values below 0o400 are allowed (0x100)
        if val < 0o40 {
            if let Some(c) = self.curr.and_then(|c| c.to_digit(8)) {
                self.bump();
                val = val * 8 + c;
            }
        }

        // We can unwrap here, because all possible values from 0 to 0o377 are
        // a valid unicode code point
        ::std::char::from_u32(val).unwrap()
    }
/// Scans 1 to 3 digits from an octal escape sequence and returns the char
/// represented by the escape code.
///
/// ## Preconditions
/// `last` needs to be '0' ... '7'
Scans 1 to 3 digits from an octal escape sequence and returns the char
represented by the escape code.
Scans 1 to 3 digits from an octal escape sequence and returns the char represented by the escape code .
fn scan_octal_escape(&mut self) -> char {
        // We are allowed to unwrap here (precondition)
        let mut val = self.last.unwrap().to_digit(8).unwrap();
        if let Some(c) = self.curr.and_then(|c| c.to_digit(8)) {
            self.bump();
            val = val * 8 + c;
        }
        // only values below 0o400 are allowed (0x100)
        if val < 0o40 {
            if let Some(c) = self.curr.and_then(|c| c.to_digit(8)) {
                self.bump();
                val = val * 8 + c;
            }
        }
        // We can unwrap here, because all possible values from 0 to 0o377 are
        // a valid unicode code point
        ::std::char::from_u32(val).unwrap()
    }
fn scan_octal_escape ( & mut self ) -> char { // We are allowed to unwrap here (precondition) let mut val = self . last . unwrap ( ) . to_digit ( 8 ) . unwrap ( ) ; if let Some ( c ) = self . curr . and_then ( | c | c . to_digit ( 8 ) ) { self . bump ( ) ; val = val * 8 + c ; } // only values below 0o400 are allowed (0x100) if val < 0o40 { if let Some ( c ) = self . curr . and_then ( | c | c . to_digit ( 8 ) ) { self . bump ( ) ; val = val * 8 + c ; } } // We can unwrap here, because all possible values from 0 to 0o377 are // a valid unicode code point :: std :: char :: from_u32 ( val ) . unwrap ( ) }
Scans 1 to 3 digits from an octal escape sequence and returns the char
represented by the escape code.
Scans 1 to 3 digits from an octal escape sequence and returns the char represented by the escape code .
&mut self
&mut self
preconditions
`last` needs to be '0' ... '7'
` last ` needs to be ' 0 ' ... ' 7 '