pub const DIGITS: &[(u8, u8)] = &[(b'0', b'9')];
pub const WORD: &[(u8, u8)] = &[(b'0', b'9'), (b'A', b'Z'), (b'a', b'z'), (b'_', b'_')];
pub const WHITESPACE: &[(u8, u8)] = &[
(b'\t', b'\t'), (b'\n', b'\n'), (b'\x0B', b'\x0B'), (b'\x0C', b'\x0C'), (b'\r', b'\r'), (b' ', b' '), ];
#[inline]
pub fn is_word_byte(b: u8) -> bool {
b.is_ascii_alphanumeric() || b == b'_'
}
#[inline]
pub fn is_whitespace_byte(b: u8) -> bool {
matches!(b, b'\t' | b'\n' | b'\x0B' | b'\x0C' | b'\r' | b' ')
}
#[inline]
pub fn is_digit_byte(b: u8) -> bool {
b.is_ascii_digit()
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_is_word_byte() {
assert!(is_word_byte(b'a'));
assert!(is_word_byte(b'Z'));
assert!(is_word_byte(b'5'));
assert!(is_word_byte(b'_'));
assert!(!is_word_byte(b'-'));
assert!(!is_word_byte(b' '));
}
#[test]
fn test_is_whitespace_byte() {
assert!(is_whitespace_byte(b' '));
assert!(is_whitespace_byte(b'\t'));
assert!(is_whitespace_byte(b'\n'));
assert!(!is_whitespace_byte(b'a'));
}
}