fn scan_char(&mut self) -> Result<u8, Box<dyn Error>> {
        let c = match self._next_char() {
            Some(c) => {
                if c != '\\' {
                    c as u8
                } else {
                    let res = match self._next_char() {
                        Some(c) => {
                            match c {
                                // TODO: Handle other characters
                                '0' => '\0',
                                'n' => '\n',
                                _ => {
                                    return Err(format!("Unknown token '{}' found after '\\' while parsing char literal.", c).into());
                                }
                            }
                        }
                        None => {
                            return Err(
                                "Unexpected end of input stream while parsing char literal".into(),
                            );
                        }
                    };
                    res as u8
                }
            }
            None => {
                return Err("Unexpected end of input stream while parsing char literal".into());
            }
        };

        match self.next_char() {
            Some(c) => {
                if c != '\'' {
                    return Err("Expected quote to terminate char literal.".into());
                }
            }
            None => {
                return Err("Unexpected end of input stream while parsing char literal".into());
            }
        };
        Ok(c)
    }
// Scans a char literal
// To be called the current character is the quotation mark
// that denotes the start of the char literal.
Scans a char literal
To be called the current character is the quotation mark
that denotes the start of the char literal.
Scans a char literal To be called the current character is the quotation mark that denotes the start of the char literal .
fn scan_char(&mut self) -> Result<u8, Box<dyn Error>> {
        let c = match self._next_char() {
            Some(c) => {
                if c != '\\' {
                    c as u8
                } else {
                    let res = match self._next_char() {
                        Some(c) => {
                            match c {
                                // TODO: Handle other characters
                                '0' => '\0',
                                'n' => '\n',
                                _ => {
                                    return Err(format!("Unknown token '{}' found after '\\' while parsing char literal.", c).into());
                                }
                            }
                        }
                        None => {
                            return Err(
                                "Unexpected end of input stream while parsing char literal".into(),
                            );
                        }
                    };
                    res as u8
                }
            }
            None => {
                return Err("Unexpected end of input stream while parsing char literal".into());
            }
        };
        match self.next_char() {
            Some(c) => {
                if c != '\'' {
                    return Err("Expected quote to terminate char literal.".into());
                }
            }
            None => {
                return Err("Unexpected end of input stream while parsing char literal".into());
            }
        };
        Ok(c)
    }
fn scan_char ( & mut self ) -> Result < u8 , Box < dyn Error > > { let c = match self . _next_char ( ) { Some ( c ) => { if c != '\\' { c as u8 } else { let res = match self . _next_char ( ) { Some ( c ) => { match c { // TODO: Handle other characters '0' => '\0' , 'n' => '\n' , _ => { return Err ( format ! ( " \\ " c ) . into ( ) ) ; } } } None => { return Err ( " " . into ( ) , ) ; } } ; res as u8 } } None => { return Err ( " " . into ( ) ) ; } } ; match self . next_char ( ) { Some ( c ) => { if c != '\'' { return Err ( " " . into ( ) ) ; } } None => { return Err ( " " . into ( ) ) ; } } ; Ok ( c ) }
Scans a char literal
To be called the current character is the quotation mark
that denotes the start of the char literal.
Scans a char literal To be called the current character is the quotation mark that denotes the start of the char literal .
&mut self