use once_cell::sync::Lazy;
use regex::Regex;
pub(super) static PERL_VAR_RE: Lazy<Option<Regex>> = Lazy::new(|| {
Regex::new(r"[$@%](?:::)?[A-Za-z_][A-Za-z0-9_]*(?:(?:::|')[A-Za-z_][A-Za-z0-9_]*)*").ok()
});
pub(super) static BRACED_PERL_VAR_RE: Lazy<Option<Regex>> = Lazy::new(|| {
Regex::new(r"([$@%])\{((?:::)?[A-Za-z_][A-Za-z0-9_]*(?:(?:::|')[A-Za-z_][A-Za-z0-9_]*)*)\}")
.ok()
});
pub(super) static SCALAR_VAR_RE: Lazy<Option<Regex>> = Lazy::new(|| {
Regex::new(r"\$(?:::)?[A-Za-z_][A-Za-z0-9_]*(?:(?:::|')[A-Za-z_][A-Za-z0-9_]*)*").ok()
});
const SPECIAL_VARS: &[&str] = &[
"$_", "$!", "$@", "$/", "$\\", "$,", "$;", "$\"", "$^", "$~", "$=", "$-", "$%", "$^W", "$^O",
"$0", "$^T", "%ENV", "%SIG", "@ARGV", "@ISA", "@INC",
];
pub(super) fn is_special_variable_name(name: &str) -> bool {
SPECIAL_VARS.contains(&name)
}