fn lex_normal_number(&mut self) -> LexResult {
        let start_pos = self.get_pos();
        let start_is_zero = self.chr0 == Some('0');
        // Normal number:
        let mut value_text = self.radix_run(10);

        // If float:
        if self.chr0 == Some('.') || self.at_exponent() {
            // Take '.':
            if self.chr0 == Some('.') {
                if self.chr1 == Some('_') {
                    return Err(LexicalError {
                        error: LexicalErrorType::OtherError("Invalid Syntax".to_owned()),
                        location: self.get_pos(),
                    });
                }
                value_text.push(self.next_char().unwrap());
                value_text.push_str(&self.radix_run(10));
            }

            // 1e6 for example:
            if self.chr0 == Some('e') || self.chr0 == Some('E') {
                if self.chr1 == Some('_') {
                    return Err(LexicalError {
                        error: LexicalErrorType::OtherError("Invalid Syntax".to_owned()),
                        location: self.get_pos(),
                    });
                }
                value_text.push(self.next_char().unwrap().to_ascii_lowercase());
                // Optional +/-
                if self.chr0 == Some('-') || self.chr0 == Some('+') {
                    if self.chr1 == Some('_') {
                        return Err(LexicalError {
                            error: LexicalErrorType::OtherError("Invalid Syntax".to_owned()),
                            location: self.get_pos(),
                        });
                    }
                    value_text.push(self.next_char().unwrap());
                }

                value_text.push_str(&self.radix_run(10));
            }

            let value = f64::from_str(&value_text).unwrap();
            // Parse trailing 'j':
            if self.chr0 == Some('j') || self.chr0 == Some('J') {
                self.next_char();
                let end_pos = self.get_pos();
                Ok((
                    start_pos,
                    Tok::Complex {
                        real: 0.0,
                        imag: value,
                    },
                    end_pos,
                ))
            } else {
                let end_pos = self.get_pos();
                Ok((start_pos, Tok::Float { value }, end_pos))
            }
        } else {
            // Parse trailing 'j':
            if self.chr0 == Some('j') || self.chr0 == Some('J') {
                self.next_char();
                let end_pos = self.get_pos();
                let imag = f64::from_str(&value_text).unwrap();
                Ok((start_pos, Tok::Complex { real: 0.0, imag }, end_pos))
            } else {
                let end_pos = self.get_pos();
                let value = value_text.parse::<BigInt>().unwrap();
                if start_is_zero && !value.is_zero() {
                    return Err(LexicalError {
                        error: LexicalErrorType::OtherError("Invalid Token".to_owned()),
                        location: self.get_pos(),
                    });
                }
                Ok((start_pos, Tok::Int { value }, end_pos))
            }
        }
    }
/// Lex a normal number, that is, no octal, hex or binary number.
Lex a normal number, that is, no octal, hex or binary number.
Lex a normal number that is no octal hex or binary number .
fn lex_normal_number(&mut self) -> LexResult {
        let start_pos = self.get_pos();
        let start_is_zero = self.chr0 == Some('0');
        // Normal number:
        let mut value_text = self.radix_run(10);
        // If float:
        if self.chr0 == Some('.') || self.at_exponent() {
            // Take '.':
            if self.chr0 == Some('.') {
                if self.chr1 == Some('_') {
                    return Err(LexicalError {
                        error: LexicalErrorType::OtherError("Invalid Syntax".to_owned()),
                        location: self.get_pos(),
                    });
                }
                value_text.push(self.next_char().unwrap());
                value_text.push_str(&self.radix_run(10));
            }
            // 1e6 for example:
            if self.chr0 == Some('e') || self.chr0 == Some('E') {
                if self.chr1 == Some('_') {
                    return Err(LexicalError {
                        error: LexicalErrorType::OtherError("Invalid Syntax".to_owned()),
                        location: self.get_pos(),
                    });
                }
                value_text.push(self.next_char().unwrap().to_ascii_lowercase());
                // Optional +/-
                if self.chr0 == Some('-') || self.chr0 == Some('+') {
                    if self.chr1 == Some('_') {
                        return Err(LexicalError {
                            error: LexicalErrorType::OtherError("Invalid Syntax".to_owned()),
                            location: self.get_pos(),
                        });
                    }
                    value_text.push(self.next_char().unwrap());
                }
                value_text.push_str(&self.radix_run(10));
            }
            let value = f64::from_str(&value_text).unwrap();
            // Parse trailing 'j':
            if self.chr0 == Some('j') || self.chr0 == Some('J') {
                self.next_char();
                let end_pos = self.get_pos();
                Ok((
                    start_pos,
                    Tok::Complex {
                        real: 0.0,
                        imag: value,
                    },
                    end_pos,
                ))
            } else {
                let end_pos = self.get_pos();
                Ok((start_pos, Tok::Float { value }, end_pos))
            }
        } else {
            // Parse trailing 'j':
            if self.chr0 == Some('j') || self.chr0 == Some('J') {
                self.next_char();
                let end_pos = self.get_pos();
                let imag = f64::from_str(&value_text).unwrap();
                Ok((start_pos, Tok::Complex { real: 0.0, imag }, end_pos))
            } else {
                let end_pos = self.get_pos();
                let value = value_text.parse::<BigInt>().unwrap();
                if start_is_zero && !value.is_zero() {
                    return Err(LexicalError {
                        error: LexicalErrorType::OtherError("Invalid Token".to_owned()),
                        location: self.get_pos(),
                    });
                }
                Ok((start_pos, Tok::Int { value }, end_pos))
            }
        }
    }
fn lex_normal_number ( & mut self ) -> LexResult { let start_pos = self . get_pos ( ) ; let start_is_zero = self . chr0 == Some ( '0' ) ; // Normal number: let mut value_text = self . radix_run ( 10 ) ; // If float: if self . chr0 == Some ( '.' ) || self . at_exponent ( ) { // Take '.': if self . chr0 == Some ( '.' ) { if self . chr1 == Some ( '_' ) { return Err ( LexicalError { error : LexicalErrorType :: OtherError ( " " . to_owned ( ) ) , location : self . get_pos ( ) , } ) ; } value_text . push ( self . next_char ( ) . unwrap ( ) ) ; value_text . push_str ( & self . radix_run ( 10 ) ) ; } // 1e6 for example: if self . chr0 == Some ( 'e' ) || self . chr0 == Some ( 'E' ) { if self . chr1 == Some ( '_' ) { return Err ( LexicalError { error : LexicalErrorType :: OtherError ( " " . to_owned ( ) ) , location : self . get_pos ( ) , } ) ; } value_text . push ( self . next_char ( ) . unwrap ( ) . to_ascii_lowercase ( ) ) ; // Optional +/- if self . chr0 == Some ( '-' ) || self . chr0 == Some ( '+' ) { if self . chr1 == Some ( '_' ) { return Err ( LexicalError { error : LexicalErrorType :: OtherError ( " " . to_owned ( ) ) , location : self . get_pos ( ) , } ) ; } value_text . push ( self . next_char ( ) . unwrap ( ) ) ; } value_text . push_str ( & self . radix_run ( 10 ) ) ; } let value = f64 :: from_str ( & value_text ) . unwrap ( ) ; // Parse trailing 'j': if self . chr0 == Some ( 'j' ) || self . chr0 == Some ( 'J' ) { self . next_char ( ) ; let end_pos = self . get_pos ( ) ; Ok ( ( start_pos , Tok :: Complex { real : 0.0 , imag : value , } , end_pos , ) ) } else { let end_pos = self . get_pos ( ) ; Ok ( ( start_pos , Tok :: Float { value } , end_pos ) ) } } else { // Parse trailing 'j': if self . chr0 == Some ( 'j' ) || self . chr0 == Some ( 'J' ) { self . next_char ( ) ; let end_pos = self . get_pos ( ) ; let imag = f64 :: from_str ( & value_text ) . unwrap ( ) ; Ok ( ( start_pos , Tok :: Complex { real : 0.0 , imag } , end_pos ) ) } else { let end_pos = self . get_pos ( ) ; let value = value_text . parse :: < BigInt > ( ) . unwrap ( ) ; if start_is_zero && ! value . is_zero ( ) { return Err ( LexicalError { error : LexicalErrorType :: OtherError ( " " . to_owned ( ) ) , location : self . get_pos ( ) , } ) ; } Ok ( ( start_pos , Tok :: Int { value } , end_pos ) ) } } }
Lex a normal number, that is, no octal, hex or binary number.
Lex a normal number that is no octal hex or binary number .
&mut self