make float parsing docs more comprehensive

This commit is contained in:
Anton Lazarev 2022-03-10 22:20:46 -08:00
parent c5a43b8d39
commit 4c17217f99
No known key found for this signature in database
GPG key ID: FBD20243E0CD9104

View file

@ -112,21 +112,24 @@ macro_rules! from_str_float_impl {
/// * '2.5E-10'
/// * '5.'
/// * '.5', or, equivalently, '0.5'
/// * 'inf', '-inf', 'NaN'
/// * 'inf', '-inf', '+infinity', 'NaN'
///
/// Note that alphabetical characters are not case-sensitive.
///
/// Leading and trailing whitespace represent an error.
///
/// # Grammar
///
/// All strings that adhere to the following [EBNF] grammar
/// will result in an [`Ok`] being returned:
/// All strings that adhere to the following [EBNF] grammar when
/// lowercased will result in an [`Ok`] being returned:
///
/// ```txt
/// Float ::= Sign? ( 'inf' | 'NaN' | Number )
/// Float ::= Sign? ( 'inf' | 'infinity' | 'nan' | Number )
/// Number ::= ( Digit+ |
/// '.' Digit* |
/// Digit+ '.' Digit* |
/// Digit* '.' Digit+ ) Exp?
/// Exp ::= [eE] Sign? Digit+
/// Exp ::= 'e' Sign? Digit+
/// Sign ::= [+-]
/// Digit ::= [0-9]
/// ```