pub(crate) fn is_number(text: &str) -> bool { text.parse::().is_ok() || text.parse::().is_ok() || text.parse::().is_ok() } pub(crate) fn is_number_and_positive(text: &str) -> bool { if text.parse::().is_ok() { true } else if let Ok(num) = text.parse::() { num.is_positive() } else if let Ok(num) = text.parse::() { num.is_sign_positive() } else { false } } pub(crate) fn usize_token(spec: &str, match_index: usize) -> Option { let mut token = None; let mut token_index = match_index + 1; while let Ok(token_suffixed) = spec .get(match_index..token_index) .unwrap_or("null") .parse::() { token = Some(token_suffixed); token_index += 1; } token }