Module core::num::dec2flt::parse [] [src]

Unstable (dec2flt)

: internal routines only exposed for testing

Validating and decomposing a decimal string of the form:

(digits | digits? '.'? digits?) (('e' | 'E') ('+' | '-')? digits)?

In other words, standard floating-point syntax, with two exceptions: No sign, and no handling of "inf" and "NaN". These are handled by the driver function (super::dec2flt).

Although recognizing valid inputs is relatively easy, this module also has to reject the countless invalid variations, never panic, and perform numerous checks that the other modules rely on to not panic (or overflow) in turn. To make matters worse, all that happens in a single pass over the input. So, be careful when modifying anything, and double-check with the other modules.


use prelude::v1::*;
use super::num;
use self::ParseResult::{Valid, ShortcutToInf, ShortcutToZero, Invalid};


Decimal [Unstable]

The interesting parts of a decimal string.


ParseResult [Unstable]
Sign [Unstable]


eat_digits [Unstable]

Carve off decimal digits up to the first non-digit character.

parse_decimal [Unstable]

Check if the input string is a valid floating point number and if so, locate the integral part, the fractional part, and the exponent in it. Does not handle signs.

parse_exp [Unstable]

Exponent extraction and error checking.