Skip to main content

zen_expression/lexer/
codes.rs

1macro_rules! token_type {
2    ("space") => { ' ' | '\n' | '\t' };
3    ("digit") => { '0'..='9' };
4    ("bracket") => { '(' | ')' | '[' | ']' | '{' | '}' };
5    ("cmp_operator") => { '>' | '<' | '!' };
6    ("operator") => { ',' | ':' | '+' | '-' | '/' | '*' | '^' | '%' };
7    ("alpha") => { 'A'..='Z' | 'a'..='z' | '$' | '_' | '#' };
8    ("alphanumeric") => { 'A'..='Z' | 'a'..='z' | '0'..='9' | '$' | '_' | '#' };
9    ("question_mark") => { '?' }
10}
11
12macro_rules! is_token_type {
13    ($str: expr, $t: tt) => {
14        matches!($str, crate::lexer::codes::token_type!($t))
15    };
16}
17
18pub(crate) use is_token_type;
19pub(crate) use token_type;