Skip to main content

shrimple_parser/pattern/
char_predicates.rs

1macro_rules! make_char_fns {
2    ($(fn $name:ident => $char_method_name:ident;)+) => {
3        $(
4            #[doc = concat!("A copy of [`char::", stringify!($name), "`] with signature adjusted to be usable as a [`Pattern`](crate::Pattern)")]
5            pub fn $name(c: char) -> bool {
6                c.$char_method_name()
7            }
8        )+
9    };
10}
11
12make_char_fns! {
13    fn alphabetic => is_alphabetic;
14    fn alphanumeric => is_alphanumeric;
15    fn control => is_control;
16    fn numeric => is_numeric;
17    fn lowercase => is_lowercase;
18    fn uppercase => is_uppercase;
19    fn whitespace => is_whitespace;
20    fn ascii => is_ascii;
21    fn ascii_alphabetic => is_ascii_alphabetic;
22    fn ascii_uppercase => is_ascii_uppercase;
23    fn ascii_lowercase => is_ascii_lowercase;
24    fn ascii_alphanumeric => is_ascii_alphanumeric;
25    fn ascii_digit => is_ascii_digit;
26    fn ascii_hexdigit => is_ascii_hexdigit;
27    fn ascii_punctuation => is_ascii_punctuation;
28    fn ascii_graphic => is_ascii_graphic;
29    fn ascii_whitespace => is_ascii_whitespace;
30    fn ascii_control => is_ascii_control;
31}