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.

Reexports

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

Structs

Decimal [Unstable]

The interesting parts of a decimal string.

Enums

ParseResult [Unstable]
Sign [Unstable]

Functions

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.