diff --git a/src/number/mod.rs b/src/number/mod.rs index 62ef29618..a7cd49970 100644 --- a/src/number/mod.rs +++ b/src/number/mod.rs @@ -1322,7 +1322,7 @@ where )) } -///todo +/// float number text parser that also recognizes "nan", "infinity" and "inf" (case insensitive) pub fn recognize_float_or_exceptions>() -> impl Parser where T: Clone + Offset, @@ -1346,7 +1346,22 @@ where )) } -/// TODO +/// single precision floating point number parser from text +pub fn float>() -> impl Parser +where + T: Clone + Offset, + T: Input + crate::traits::ParseTo + Compare<&'static str>, + ::Item: AsChar + Clone, + T: AsBytes, + T: for<'a> Compare<&'a [u8]>, +{ + Float { + o: PhantomData, + e: PhantomData, + } +} + +/// double precision floating point number parser from text pub fn double>() -> impl Parser where T: Clone + Offset, @@ -1355,23 +1370,27 @@ where T: AsBytes, T: for<'a> Compare<&'a [u8]>, { - Double { e: PhantomData } + Float { + o: PhantomData, + e: PhantomData, + } } -/// TODO -struct Double { +/// f64 parser from text +struct Float { + o: PhantomData, e: PhantomData, } -impl> Parser for Double +impl> Parser for Float where I: Clone + Offset, - I: Input + crate::traits::ParseTo + Compare<&'static str>, + I: Input + crate::traits::ParseTo + Compare<&'static str>, ::Item: AsChar + Clone, I: AsBytes, I: for<'a> Compare<&'a [u8]>, { - type Output = f64; + type Output = O; type Error = E; fn process(