Pre-parse a supposed entity name by splitting it into two parts: A head of lowercase ASCII letters and numeric tail.
(name: &str)
| 108 | /// Pre-parse a supposed entity name by splitting it into two parts: A head of lowercase ASCII |
| 109 | /// letters and numeric tail. |
| 110 | pub fn split_entity_name(name: &str) -> Option<(&str, u32)> { |
| 111 | let (head, tail) = name.split_at(name.len() - trailing_digits(name)); |
| 112 | if tail.len() > 1 && tail.starts_with('0') { |
| 113 | None |
| 114 | } else { |
| 115 | tail.parse().ok().map(|n| (head, n)) |
| 116 | } |
| 117 | } |
| 118 | |
| 119 | /// Lexical analysis. |
| 120 | /// |
no test coverage detected