pub(crate) fn regex_operators() -> Vec<(&'static str, &'static str)> {
vec![
(r"--(\b\w+\b)", r"++$1"),
(r"(\b\w+\b)--", r"$1++"),
("continue", "break"),
("break", "continue"),
("true", "false"),
("false", "true"),
(r" / ", " * "),
(r" >= ", " > "),
(r" <= ", " < "),
(r" > ", " >= "),
(r" < ", " <= "),
(r" >= ", " <= "),
(r" <= ", " >= "),
(r" > ", " < "),
(r" < ", " > "),
(r" > ", " <= "),
(r" < ", " >= "),
(r"&&", "||"),
(r"\|\|", "&&"),
(r" == ", " != "),
(r" != ", " == "),
(" - ", " + "),
(r" \+ ", " - "),
(r" \+ ", " * "),
(r" \+ ", " / "),
(r"\((-?\d+)\)", r"($1 - 1)"),
(r"\((-?\d+)\)", r"($1 + 1)"),
(r"\b(if|else\s+if|while)\s*\(([^()]*)\)", r"$1 (1==1)"),
(r"\b(if|else\s+if|while)\s*\(([^()]*)\)", r"$1 (1==0)"),
(
r"^\s*[a-zA-Z_]\w*(?:::[a-zA-Z_]\w*)*(?:(?:->|\.)[a-zA-Z_]\w*)*\s*\([^;]*\)\s*;$",
"",
),
(r"^.*if\s*\(.*\)\s*continue;.*$", ""),
(r"^.*if\s*\(.*\)\s*return;.*$", ""),
(r"^.*if\s*\(.*\)\s*return.*;.*$", ""),
(r"^(.*for\s*\(.*;.*;.*\)\s*\{.*)$", r"$1break;"),
(r"^(.*while\s*\(.*\)\s*\{.*)$", r"$1break;"),
]
}
pub(crate) fn security_operators() -> Vec<(&'static str, &'static str)> {
vec![
("==", "="),
(r" - ", " + "),
(r"\s\+\s", "-"),
(
r"\b((?:int16_t|uint16_t|int32_t|uint32_t|int64_t|uint64_t|int)\s*[\(\{])([^\)\}]*)[\)\}]",
"$2",
),
(r"ignore\((\s*(\d+)\s*)\)", r"ignore($2 + 100)"),
(r"(\w+)\[(\w+)\]", r"$1[$2 + 5]"),
(
r"^\s*(?:\(void\)\s*)?[a-zA-Z_][\w:]*\s*\([\w\s,]*\)\s*;\s*$",
"",
),
(r"if\s*\(\s*(.*?)\s*\|\|\s*(.*?)\s*\)", r"if($2||$1)"),
]
}
pub(crate) fn test_operators() -> Vec<(&'static str, &'static str)> {
vec![(r"^\s*(?:\w+(?:\.|->|::))*(\w+)\s*\([^)]*\)\s*;?\s*$", "")]
}
pub(crate) fn do_not_mutate_patterns() -> Vec<&'static str> {
vec!["/", "//", "#", "*", "/*", "assert"]
}