fn scan_char_literal(&mut self) -> Result<char, char> {
        self.bump();    // discard '
        match self.scan_escaped_char() {
            ScannedChar::Normal('\'') => {
                Err(self.simple_error('\0', "empty character literal")
                        .map_report(|r| r.with_note("maybe you want to use an \
                            empty string `\"\"` instead?")))
            },
            ScannedChar::Normal(c) | ScannedChar::Escape(c) => {
                // we need another ' to close the literal
                if self.curr == Some('\'') {
                    self.bump();
                    Ok(c)
                } else {
                    Err(self.simple_error('\0', "unclosed character literal"))
                }
            },
            ScannedChar::InvalidEscape(c) => {
                Err(self.simple_error(c,
                        format!("invalid escape character `\\{}`", c)
                    ).map_report(|r| r.with_note("valid escape characters are \
                        \\b \\t \\n \\f \\r \\\" \\' \\\\ or octal escapes"
                    ))
                )
            },
            ScannedChar::Eof => {
                Err(self.simple_error('\0',
                    "unexpected EOF in character literal"))
            }
        }
    }
/// Scans a Java string literal.
///
/// ## Preconditions
/// `curr` needs to be `'`
Scans a Java string literal.
Scans a Java string literal .
fn scan_char_literal(&mut self) -> Result<char, char> {
        self.bump();    // discard '
        match self.scan_escaped_char() {
            ScannedChar::Normal('\'') => {
                Err(self.simple_error('\0', "empty character literal")
                        .map_report(|r| r.with_note("maybe you want to use an \
                            empty string `\"\"` instead?")))
            },
            ScannedChar::Normal(c) | ScannedChar::Escape(c) => {
                // we need another ' to close the literal
                if self.curr == Some('\'') {
                    self.bump();
                    Ok(c)
                } else {
                    Err(self.simple_error('\0', "unclosed character literal"))
                }
            },
            ScannedChar::InvalidEscape(c) => {
                Err(self.simple_error(c,
                        format!("invalid escape character `\\{}`", c)
                    ).map_report(|r| r.with_note("valid escape characters are \
                        \\b \\t \\n \\f \\r \\\" \\' \\\\ or octal escapes"
                    ))
                )
            },
            ScannedChar::Eof => {
                Err(self.simple_error('\0',
                    "unexpected EOF in character literal"))
            }
        }
    }
fn scan_char_literal ( & mut self ) -> Result < char , char > { self . bump ( ) ; // discard ' match self . scan_escaped_char ( ) { ScannedChar :: Normal ( '\'' ) => { Err ( self . simple_error ( '\0' , " " ) . map_report ( | r | r . with_note ( " \
 \" \" " ) ) ) } , ScannedChar :: Normal ( c ) | ScannedChar :: Escape ( c ) => { // we need another ' to close the literal if self . curr == Some ( '\'' ) { self . bump ( ) ; Ok ( c ) } else { Err ( self . simple_error ( '\0' , " " ) ) } } , ScannedChar :: InvalidEscape ( c ) => { Err ( self . simple_error ( c , format ! ( " \\ " c ) ) . map_report ( | r | r . with_note ( " \
 \\ \\ \\ \\ \\ \\ \" \\ \\ \\ " ) ) ) } , ScannedChar :: Eof => { Err ( self . simple_error ( '\0' , " " ) ) } } }
Scans a Java string literal.
Scans a Java string literal .
&mut self
&mut self
preconditions
`curr` needs to be `'`
` curr ` needs to be ` ' `