fn lex_number(l: &mut Lexer) -> Option<StateFn> {
    //
    // See R7RS 7.1.1 for detailed format for numeric constants
    //
    let mut nl = NumberLexer::new();

    // Scan for every conceivable numeric literal known to Scheme...
    let prefix_result = nl.accept_prefix_r(l);
    if prefix_result.is_err() {
        return errorf(l, prefix_result.unwrap_err());
    }
    let real_result = nl.accept_real_r(l, true);
    if real_result.is_err() {
        return errorf(l, real_result.unwrap_err());
    }
    if l.accept("@") {
        nl.is_complex = true;
        let real_result2 = nl.accept_real_r(l, false);
        if real_result2.is_err() {
            return errorf(l, real_result2.unwrap_err());
        }
    } else if l.accept("+-") {
        nl.is_complex = true;
        let ureal_result = nl.accept_ureal_r(l, true);
        if ureal_result.is_err() {
            return errorf(l, ureal_result.unwrap_err());
        }
        let infnan_result = nl.accept_infnan(l);
        if infnan_result.is_err() {
            return errorf(l, infnan_result.unwrap_err());
        }
        if !l.accept("iI") {
            return errorf(l, "malformed complex");
        }
    }
    let infnan_result = nl.accept_infnan(l);
    if infnan_result.is_err() {
        return errorf(l, infnan_result.unwrap_err());
    }
    if l.accept("iI") {
        nl.is_complex = true;
    }

    // Next character must not be alphanumeric or related to numbers in any
    // way ('.', '+', '-', '@'), which happens to be "special subsequent".
    if let Some(ch) = l.peek() {
        if !is_delimiter(ch) {
            l.next();
            return errorf(l, "malformed number suffix");
        }
    }
    if nl.is_complex {
        l.emit(TokenType::Complex);
    } else if nl.is_rational {
        l.emit(TokenType::Rational);
    } else if nl.is_float {
        l.emit(TokenType::Float);
    } else {
        l.emit(TokenType::Integer);
    }
    Some(StateFn(lex_start))
}
/// `lex_number` expects the current position to be the start of a numeric
/// literal, and advances to the end of the literal. It will parse both
/// integer and floating point decimal values.
`lex_number` expects the current position to be the start of a numeric
literal, and advances to the end of the literal. It will parse both
integer and floating point decimal values.
` lex_number ` expects the current position to be the start of a numeric literal and advances to the end of the literal . It will parse both integer and floating point decimal values .
fn lex_number(l: &mut Lexer) -> Option<StateFn> {
    //
    // See R7RS 7.1.1 for detailed format for numeric constants
    //
    let mut nl = NumberLexer::new();
    // Scan for every conceivable numeric literal known to Scheme...
    let prefix_result = nl.accept_prefix_r(l);
    if prefix_result.is_err() {
        return errorf(l, prefix_result.unwrap_err());
    }
    let real_result = nl.accept_real_r(l, true);
    if real_result.is_err() {
        return errorf(l, real_result.unwrap_err());
    }
    if l.accept("@") {
        nl.is_complex = true;
        let real_result2 = nl.accept_real_r(l, false);
        if real_result2.is_err() {
            return errorf(l, real_result2.unwrap_err());
        }
    } else if l.accept("+-") {
        nl.is_complex = true;
        let ureal_result = nl.accept_ureal_r(l, true);
        if ureal_result.is_err() {
            return errorf(l, ureal_result.unwrap_err());
        }
        let infnan_result = nl.accept_infnan(l);
        if infnan_result.is_err() {
            return errorf(l, infnan_result.unwrap_err());
        }
        if !l.accept("iI") {
            return errorf(l, "malformed complex");
        }
    }
    let infnan_result = nl.accept_infnan(l);
    if infnan_result.is_err() {
        return errorf(l, infnan_result.unwrap_err());
    }
    if l.accept("iI") {
        nl.is_complex = true;
    }
    // Next character must not be alphanumeric or related to numbers in any
    // way ('.', '+', '-', '@'), which happens to be "special subsequent".
    if let Some(ch) = l.peek() {
        if !is_delimiter(ch) {
            l.next();
            return errorf(l, "malformed number suffix");
        }
    }
    if nl.is_complex {
        l.emit(TokenType::Complex);
    } else if nl.is_rational {
        l.emit(TokenType::Rational);
    } else if nl.is_float {
        l.emit(TokenType::Float);
    } else {
        l.emit(TokenType::Integer);
    }
    Some(StateFn(lex_start))
}
fn lex_number ( l : & mut Lexer ) -> Option < StateFn > { // // See R7RS 7.1.1 for detailed format for numeric constants // let mut nl = NumberLexer :: new ( ) ; // Scan for every conceivable numeric literal known to Scheme... let prefix_result = nl . accept_prefix_r ( l ) ; if prefix_result . is_err ( ) { return errorf ( l , prefix_result . unwrap_err ( ) ) ; } let real_result = nl . accept_real_r ( l , true ) ; if real_result . is_err ( ) { return errorf ( l , real_result . unwrap_err ( ) ) ; } if l . accept ( " " ) { nl . is_complex = true ; let real_result2 = nl . accept_real_r ( l , false ) ; if real_result2 . is_err ( ) { return errorf ( l , real_result2 . unwrap_err ( ) ) ; } } else if l . accept ( " " ) { nl . is_complex = true ; let ureal_result = nl . accept_ureal_r ( l , true ) ; if ureal_result . is_err ( ) { return errorf ( l , ureal_result . unwrap_err ( ) ) ; } let infnan_result = nl . accept_infnan ( l ) ; if infnan_result . is_err ( ) { return errorf ( l , infnan_result . unwrap_err ( ) ) ; } if ! l . accept ( " " ) { return errorf ( l , " " ) ; } } let infnan_result = nl . accept_infnan ( l ) ; if infnan_result . is_err ( ) { return errorf ( l , infnan_result . unwrap_err ( ) ) ; } if l . accept ( " " ) { nl . is_complex = true ; } // Next character must not be alphanumeric or related to numbers in any // way ('.', '+', '-', '@'), which happens to be "special subsequent". if let Some ( ch ) = l . peek ( ) { if ! is_delimiter ( ch ) { l . next ( ) ; return errorf ( l , " " ) ; } } if nl . is_complex { l . emit ( TokenType :: Complex ) ; } else if nl . is_rational { l . emit ( TokenType :: Rational ) ; } else if nl . is_float { l . emit ( TokenType :: Float ) ; } else { l . emit ( TokenType :: Integer ) ; } Some ( StateFn ( lex_start ) ) }
`lex_number` expects the current position to be the start of a numeric
literal, and advances to the end of the literal.
` lex_number ` expects the current position to be the start of a numeric literal and advances to the end of the literal .
l
&mut Lexer