Alphabetized character logic in macros.rs and system_calls.rs
This commit is contained in:
@@ -4,131 +4,6 @@ macro_rules! char_class {
|
|||||||
($c: expr, [$head:expr $(, $cs:expr)+]) => ($c == $head || $crate::char_class!($c, [$($cs),*]));
|
($c: expr, [$head:expr $(, $cs:expr)+]) => ($c == $head || $crate::char_class!($c, [$($cs),*]));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[macro_export]
|
|
||||||
macro_rules! symbolic_control_char {
|
|
||||||
($c: expr) => {
|
|
||||||
$crate::char_class!($c, ['a', 'b', 'f', 'n', 'r', 't', 'v', '0'])
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#[macro_export]
|
|
||||||
macro_rules! space_char {
|
|
||||||
($c: expr) => {
|
|
||||||
$c == ' '
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#[macro_export]
|
|
||||||
macro_rules! layout_char {
|
|
||||||
($c: expr) => {
|
|
||||||
$crate::char_class!($c, [' ', '\n', '\t', '\u{0B}', '\u{0C}'])
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#[macro_export]
|
|
||||||
macro_rules! symbolic_hexadecimal_char {
|
|
||||||
($c: expr) => {
|
|
||||||
$c == 'x'
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#[macro_export]
|
|
||||||
macro_rules! octal_digit_char {
|
|
||||||
($c: expr) => {
|
|
||||||
('0'..='7').contains(&$c)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#[macro_export]
|
|
||||||
macro_rules! binary_digit_char {
|
|
||||||
($c: expr) => {
|
|
||||||
$c >= '0' && $c <= '1'
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#[macro_export]
|
|
||||||
macro_rules! hexadecimal_digit_char {
|
|
||||||
($c: expr) => {
|
|
||||||
('0'..='9').contains(&$c) || ('A'..='F').contains(&$c) || ('a'..='f').contains(&$c)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#[macro_export]
|
|
||||||
macro_rules! exponent_char {
|
|
||||||
($c: expr) => {
|
|
||||||
$c == 'e' || $c == 'E'
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#[macro_export]
|
|
||||||
macro_rules! sign_char {
|
|
||||||
($c: expr) => {
|
|
||||||
$c == '-' || $c == '+'
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#[macro_export]
|
|
||||||
macro_rules! new_line_char {
|
|
||||||
($c: expr) => {
|
|
||||||
$c == '\n'
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#[macro_export]
|
|
||||||
macro_rules! end_line_comment_char {
|
|
||||||
($c: expr) => {
|
|
||||||
$c == '%'
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#[macro_export]
|
|
||||||
macro_rules! comment_1_char {
|
|
||||||
($c: expr) => {
|
|
||||||
$c == '/'
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#[macro_export]
|
|
||||||
macro_rules! comment_2_char {
|
|
||||||
($c: expr) => {
|
|
||||||
$c == '*'
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#[macro_export]
|
|
||||||
macro_rules! capital_letter_char {
|
|
||||||
($c: expr) => {
|
|
||||||
('A'..='Z').contains(&$c)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#[macro_export]
|
|
||||||
macro_rules! small_letter_char {
|
|
||||||
($c: expr) => {
|
|
||||||
('a'..='z').contains(&$c)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#[macro_export]
|
|
||||||
macro_rules! variable_indicator_char {
|
|
||||||
($c: expr) => {
|
|
||||||
$c == '_'
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#[macro_export]
|
|
||||||
macro_rules! graphic_char {
|
|
||||||
($c: expr) => ($crate::char_class!($c, ['#', '$', '&', '*', '+', '-', '.', '/', ':',
|
|
||||||
'<', '=', '>', '?', '@', '^', '~']))
|
|
||||||
}
|
|
||||||
|
|
||||||
#[macro_export]
|
|
||||||
macro_rules! graphic_token_char {
|
|
||||||
($c: expr) => {
|
|
||||||
$crate::graphic_char!($c) || $crate::backslash_char!($c)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! alpha_char {
|
macro_rules! alpha_char {
|
||||||
($c: expr) => {
|
($c: expr) => {
|
||||||
@@ -157,6 +32,62 @@ macro_rules! alpha_char {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[macro_export]
|
||||||
|
macro_rules! alpha_numeric_char {
|
||||||
|
($c: expr) => {
|
||||||
|
$crate::alpha_char!($c) || $crate::decimal_digit_char!($c)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#[macro_export]
|
||||||
|
macro_rules! backslash_char {
|
||||||
|
($c: expr) => {
|
||||||
|
$c == '\\'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#[macro_export]
|
||||||
|
macro_rules! back_quote_char {
|
||||||
|
($c: expr) => {
|
||||||
|
$c == '`'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#[macro_export]
|
||||||
|
macro_rules! binary_digit_char {
|
||||||
|
($c: expr) => {
|
||||||
|
$c >= '0' && $c <= '1'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#[macro_export]
|
||||||
|
macro_rules! capital_letter_char {
|
||||||
|
($c: expr) => {
|
||||||
|
('A'..='Z').contains(&$c)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#[macro_export]
|
||||||
|
macro_rules! comment_1_char {
|
||||||
|
($c: expr) => {
|
||||||
|
$c == '/'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#[macro_export]
|
||||||
|
macro_rules! comment_2_char {
|
||||||
|
($c: expr) => {
|
||||||
|
$c == '*'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#[macro_export]
|
||||||
|
macro_rules! cut_char {
|
||||||
|
($c: expr) => {
|
||||||
|
$c == '!'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! decimal_digit_char {
|
macro_rules! decimal_digit_char {
|
||||||
($c: expr) => {
|
($c: expr) => {
|
||||||
@@ -171,41 +102,6 @@ macro_rules! decimal_point_char {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#[macro_export]
|
|
||||||
macro_rules! alpha_numeric_char {
|
|
||||||
($c: expr) => {
|
|
||||||
$crate::alpha_char!($c) || $crate::decimal_digit_char!($c)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#[macro_export]
|
|
||||||
macro_rules! cut_char {
|
|
||||||
($c: expr) => {
|
|
||||||
$c == '!'
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#[macro_export]
|
|
||||||
macro_rules! semicolon_char {
|
|
||||||
($c: expr) => {
|
|
||||||
$c == ';'
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#[macro_export]
|
|
||||||
macro_rules! backslash_char {
|
|
||||||
($c: expr) => {
|
|
||||||
$c == '\\'
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#[macro_export]
|
|
||||||
macro_rules! single_quote_char {
|
|
||||||
($c: expr) => {
|
|
||||||
$c == '\''
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! double_quote_char {
|
macro_rules! double_quote_char {
|
||||||
($c: expr) => {
|
($c: expr) => {
|
||||||
@@ -214,9 +110,43 @@ macro_rules! double_quote_char {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! back_quote_char {
|
macro_rules! end_line_comment_char {
|
||||||
($c: expr) => {
|
($c: expr) => {
|
||||||
$c == '`'
|
$c == '%'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#[macro_export]
|
||||||
|
macro_rules! exponent_char {
|
||||||
|
($c: expr) => {
|
||||||
|
$c == 'e' || $c == 'E'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#[macro_export]
|
||||||
|
macro_rules! graphic_char {
|
||||||
|
($c: expr) => ($crate::char_class!($c, ['#', '$', '&', '*', '+', '-', '.', '/', ':',
|
||||||
|
'<', '=', '>', '?', '@', '^', '~']))
|
||||||
|
}
|
||||||
|
|
||||||
|
#[macro_export]
|
||||||
|
macro_rules! graphic_token_char {
|
||||||
|
($c: expr) => {
|
||||||
|
$crate::graphic_char!($c) || $crate::backslash_char!($c)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#[macro_export]
|
||||||
|
macro_rules! hexadecimal_digit_char {
|
||||||
|
($c: expr) => {
|
||||||
|
('0'..='9').contains(&$c) || ('A'..='F').contains(&$c) || ('a'..='f').contains(&$c)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#[macro_export]
|
||||||
|
macro_rules! layout_char {
|
||||||
|
($c: expr) => {
|
||||||
|
$crate::char_class!($c, [' ', '\n', '\t', '\u{0B}', '\u{0C}'])
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -228,9 +158,23 @@ macro_rules! meta_char {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! solo_char {
|
macro_rules! new_line_char {
|
||||||
($c: expr) => {
|
($c: expr) => {
|
||||||
$crate::char_class!($c, ['!', '(', ')', ',', ';', '[', ']', '{', '}', '|', '%'])
|
$c == '\n'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#[macro_export]
|
||||||
|
macro_rules! octal_digit_char {
|
||||||
|
($c: expr) => {
|
||||||
|
('0'..='7').contains(&$c)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#[macro_export]
|
||||||
|
macro_rules! octet_char {
|
||||||
|
($c: expr) => {
|
||||||
|
('\u{0000}'..='\u{00FF}').contains(&$c)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -244,3 +188,66 @@ macro_rules! prolog_char {
|
|||||||
|| $crate::meta_char!($c)
|
|| $crate::meta_char!($c)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[macro_export]
|
||||||
|
macro_rules! semicolon_char {
|
||||||
|
($c: expr) => {
|
||||||
|
$c == ';'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#[macro_export]
|
||||||
|
macro_rules! sign_char {
|
||||||
|
($c: expr) => {
|
||||||
|
$c == '-' || $c == '+'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#[macro_export]
|
||||||
|
macro_rules! single_quote_char {
|
||||||
|
($c: expr) => {
|
||||||
|
$c == '\''
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#[macro_export]
|
||||||
|
macro_rules! small_letter_char {
|
||||||
|
($c: expr) => {
|
||||||
|
('a'..='z').contains(&$c)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#[macro_export]
|
||||||
|
macro_rules! solo_char {
|
||||||
|
($c: expr) => {
|
||||||
|
$crate::char_class!($c, ['!', '(', ')', ',', ';', '[', ']', '{', '}', '|', '%'])
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#[macro_export]
|
||||||
|
macro_rules! space_char {
|
||||||
|
($c: expr) => {
|
||||||
|
$c == ' '
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#[macro_export]
|
||||||
|
macro_rules! symbolic_control_char {
|
||||||
|
($c: expr) => {
|
||||||
|
$crate::char_class!($c, ['a', 'b', 'f', 'n', 'r', 't', 'v', '0'])
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#[macro_export]
|
||||||
|
macro_rules! symbolic_hexadecimal_char {
|
||||||
|
($c: expr) => {
|
||||||
|
$c == 'x'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#[macro_export]
|
||||||
|
macro_rules! variable_indicator_char {
|
||||||
|
($c: expr) => {
|
||||||
|
$c == '_'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|||||||
@@ -1775,46 +1775,46 @@ impl MachineState {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
macro_check!(symbolic_control_char, "symbolic_control");
|
|
||||||
// macro_check!(space_char, "space");
|
|
||||||
macro_check!(layout_char, "layout");
|
|
||||||
macro_check!(symbolic_hexadecimal_char, "symbolic_hexadecimal");
|
|
||||||
macro_check!(octal_digit_char, "octal_digit");
|
|
||||||
macro_check!(binary_digit_char, "binary_digit");
|
|
||||||
macro_check!(hexadecimal_digit_char, "hexadecimal_digit");
|
|
||||||
macro_check!(exponent_char, "exponent");
|
|
||||||
macro_check!(sign_char, "sign");
|
|
||||||
// macro_check!(new_line_char, "new_line");
|
|
||||||
// macro_check!(comment_1_char, "comment_1");
|
|
||||||
// macro_check!(comment_2_char, "comment_2");
|
|
||||||
// macro_check!(capital_letter_char, "upper");
|
|
||||||
// macro_check!(small_letter_char, "lower");
|
|
||||||
// macro_check!(variable_indicator_char, "variable_indicator");
|
|
||||||
macro_check!(graphic_char, "graphic");
|
|
||||||
macro_check!(graphic_token_char, "graphic_token");
|
|
||||||
macro_check!(alpha_char, "alpha");
|
macro_check!(alpha_char, "alpha");
|
||||||
macro_check!(decimal_digit_char, "decimal_digit");
|
|
||||||
// macro_check!(decimal_point_char, "decimal_point");
|
|
||||||
macro_check!(alpha_numeric_char, "alnum");
|
|
||||||
// macro_check!(cut_char, "cut");
|
|
||||||
// macro_check!(semicolon_char, "semicolon");
|
|
||||||
// macro_check!(backslash_char, "backslash");
|
|
||||||
// macro_check!(single_quote_char, "single_quote");
|
|
||||||
// macro_check!(double_quote_char, "double_quote");
|
|
||||||
// macro_check!(back_quote_char, "back_quote");
|
|
||||||
macro_check!(meta_char, "meta");
|
|
||||||
macro_check!(solo_char, "solo");
|
|
||||||
macro_check!(prolog_char, "prolog");
|
|
||||||
method_check!(is_alphabetic, "alphabetic");
|
method_check!(is_alphabetic, "alphabetic");
|
||||||
method_check!(is_lowercase, "lower");
|
|
||||||
method_check!(is_uppercase, "upper");
|
|
||||||
method_check!(is_whitespace, "whitespace");
|
|
||||||
method_check!(is_alphanumeric, "alphanumeric");
|
method_check!(is_alphanumeric, "alphanumeric");
|
||||||
method_check!(is_control, "control");
|
macro_check!(alpha_numeric_char, "alnum");
|
||||||
method_check!(is_numeric, "numeric");
|
|
||||||
method_check!(is_ascii, "ascii");
|
method_check!(is_ascii, "ascii");
|
||||||
method_check!(is_ascii_punctuation, "ascii_ponctuaction");
|
method_check!(is_ascii_punctuation, "ascii_ponctuaction");
|
||||||
method_check!(is_ascii_graphic, "ascii_graphic");
|
method_check!(is_ascii_graphic, "ascii_graphic");
|
||||||
|
// macro_check!(backslash_char, "backslash");
|
||||||
|
// macro_check!(back_quote_char, "back_quote");
|
||||||
|
macro_check!(binary_digit_char, "binary_digit");
|
||||||
|
// macro_check!(capital_letter_char, "upper");
|
||||||
|
// macro_check!(comment_1_char, "comment_1");
|
||||||
|
// macro_check!(comment_2_char, "comment_2");
|
||||||
|
method_check!(is_control, "control");
|
||||||
|
// macro_check!(cut_char, "cut");
|
||||||
|
macro_check!(decimal_digit_char, "decimal_digit");
|
||||||
|
// macro_check!(decimal_point_char, "decimal_point");
|
||||||
|
// macro_check!(double_quote_char, "double_quote");
|
||||||
|
macro_check!(exponent_char, "exponent");
|
||||||
|
macro_check!(graphic_char, "graphic");
|
||||||
|
macro_check!(graphic_token_char, "graphic_token");
|
||||||
|
macro_check!(hexadecimal_digit_char, "hexadecimal_digit");
|
||||||
|
macro_check!(layout_char, "layout");
|
||||||
|
method_check!(is_lowercase, "lower");
|
||||||
|
macro_check!(meta_char, "meta");
|
||||||
|
// macro_check!(new_line_char, "new_line");
|
||||||
|
method_check!(is_numeric, "numeric");
|
||||||
|
macro_check!(octal_digit_char, "octal_digit");
|
||||||
|
macro_check!(prolog_char, "prolog");
|
||||||
|
// macro_check!(semicolon_char, "semicolon");
|
||||||
|
macro_check!(sign_char, "sign");
|
||||||
|
// macro_check!(single_quote_char, "single_quote");
|
||||||
|
// macro_check!(small_letter_char, "lower");
|
||||||
|
macro_check!(solo_char, "solo");
|
||||||
|
// macro_check!(space_char, "space");
|
||||||
|
macro_check!(symbolic_hexadecimal_char, "symbolic_hexadecimal");
|
||||||
|
macro_check!(symbolic_control_char, "symbolic_control");
|
||||||
|
method_check!(is_uppercase, "upper");
|
||||||
|
// macro_check!(variable_indicator_char, "variable_indicator");
|
||||||
|
method_check!(is_whitespace, "whitespace");
|
||||||
}
|
}
|
||||||
&SystemClauseType::CheckCutPoint => {
|
&SystemClauseType::CheckCutPoint => {
|
||||||
let addr = self.store(self.deref(self[temp_v!(1)]));
|
let addr = self.store(self.deref(self[temp_v!(1)]));
|
||||||
|
|||||||
Reference in New Issue
Block a user