use regex::Regex;
pub const OPERATORS: &[&str] = &[
"(", ")", "[", "]", ":", ",", ";", "+", "-", "*", "/", "|", "&", "<", ">", "=", ".", "%", "{", "}", "==", "!=", "<=", ">=", "~", "^", "<<", ">>", "**", "+=", "-=", "*=", "/=", "%=", "&=", "|=", "^=", "<<=", ">>=", "**=", "//", "//=", "@", "@=", "->", "...", ":=", "!",
"<>",
];
thread_local! {
pub static OPERATOR_RE: Regex = {
let mut sorted_operators: Box<[&str]> = OPERATORS.into();
sorted_operators.sort_unstable_by_key(|op| usize::MAX - op.len());
Regex::new(&format!(
r"\A({})",
sorted_operators
.iter()
.map(|op| regex::escape(op))
.collect::<Vec<_>>()
.join("|")
))
.expect("regex")
};
}