Validate the remainder of a float literal after the 'e'/'E'.
(bytes: &[u8])
| 133 | |
| 134 | /// Validate the remainder of a float literal after the 'e'/'E'. |
| 135 | fn validate_float_suffix(bytes: &[u8]) -> bool { |
| 136 | if bytes.is_empty() { |
| 137 | return false; |
| 138 | } |
| 139 | let start = if bytes[0] == b'+' || bytes[0] == b'-' { |
| 140 | 1 |
| 141 | } else { |
| 142 | 0 |
| 143 | }; |
| 144 | if start >= bytes.len() { |
| 145 | return false; |
| 146 | } |
| 147 | bytes[start..] |
| 148 | .iter() |
| 149 | .all(|b| b.is_ascii_digit() || *b == b'_') |
| 150 | && bytes[start..].iter().any(|b| b.is_ascii_digit()) |
| 151 | } |
| 152 | |
| 153 | /// Returns `true` when the text is a concatenated string expression |
| 154 | /// like `'prefix_' . 'suffix'`. Each segment must be a string literal |
no test coverage detected