use std::sync::LazyLock;
static C_DEF_REGEX: LazyLock<Regex> = LazyLock::new(|| {
Regex::new(
r"(?m)^\s*(?:static\s+)?(?:inline\s+)?(?:void|int|char|float|double|long|short|unsigned|struct\s+\w+|enum\s+\w+|\w+\s+\*?)\s+(\w+)\s*\([^)]*\)\s*(?:\{|$)"
).expect("C_DEF_REGEX: hardcoded constant pattern")
});
static C_CALL_REGEX: LazyLock<Regex> = LazyLock::new(|| {
Regex::new(r"\b(\w+)\s*\(").expect("C_CALL_REGEX: hardcoded constant pattern")
});
static C_DECLARATION_REGEX: LazyLock<Regex> = LazyLock::new(|| {
Regex::new(
r"^\s*(?:static\s+)?(?:inline\s+)?(?:extern\s+)?(?:void|int|char|float|double|long|short|unsigned|struct\s+\w+|enum\s+\w+|\w+\s+\*?)\s+\w+\s*\("
).expect("C_DECLARATION_REGEX: hardcoded constant pattern")
});
static PY_DEF_REGEX: LazyLock<Regex> = LazyLock::new(|| {
Regex::new(r"(?m)^\s*def\s+(\w+)\s*\(").expect("PY_DEF_REGEX: hardcoded constant pattern")
});
static PY_CALL_REGEX: LazyLock<Regex> = LazyLock::new(|| {
Regex::new(r"\b(\w+)\s*\(").expect("PY_CALL_REGEX: hardcoded constant pattern")
});
static PY_DEF_CHECK_REGEX: LazyLock<Regex> = LazyLock::new(|| {
Regex::new(r"^\s*def\s+\w+\s*\(").expect("PY_DEF_CHECK_REGEX: hardcoded constant pattern")
});
static RUST_DEF_REGEX: LazyLock<Regex> = LazyLock::new(|| {
Regex::new(r"(?m)^\s*(?:pub\s+)?(?:async\s+)?fn\s+(\w+)\s*[<(]")
.expect("RUST_DEF_REGEX: hardcoded constant pattern")
});
static RUST_CALL_REGEX: LazyLock<Regex> = LazyLock::new(|| {
Regex::new(r"\b(\w+)\s*[!]?\(").expect("RUST_CALL_REGEX: hardcoded constant pattern")
});
static RUST_FN_DEF_REGEX: LazyLock<Regex> = LazyLock::new(|| {
Regex::new(r"^\s*(?:pub\s+)?(?:async\s+)?fn\s+\w+")
.expect("RUST_FN_DEF_REGEX: hardcoded constant pattern")
});
static LUA_LOCAL_FUNC_REGEX: LazyLock<Regex> = LazyLock::new(|| {
Regex::new(r"(?m)^\s*local\s+function\s+(\w+)\s*\(")
.expect("LUA_LOCAL_FUNC_REGEX: hardcoded constant pattern")
});
static LUA_GLOBAL_FUNC_REGEX: LazyLock<Regex> = LazyLock::new(|| {
Regex::new(r"(?m)^\s*function\s+(\w+)\s*\(")
.expect("LUA_GLOBAL_FUNC_REGEX: hardcoded constant pattern")
});
static LUA_MODULE_FUNC_NAME_REGEX: LazyLock<Regex> = LazyLock::new(|| {
Regex::new(r"(?m)^\s*function\s+(\w+)[.:](\w+)\s*\(")
.expect("LUA_MODULE_FUNC_NAME_REGEX: hardcoded constant pattern")
});
static LUA_CALL_REGEX: LazyLock<Regex> = LazyLock::new(|| {
Regex::new(r"\b(\w+)\s*\(").expect("LUA_CALL_REGEX: hardcoded constant pattern")
});
static LUA_RETURN_MODULE_REGEX: LazyLock<Regex> = LazyLock::new(|| {
Regex::new(r"^\s*return\s+(\w+)\s*$")
.expect("LUA_RETURN_MODULE_REGEX: hardcoded constant pattern")
});
static LUA_TABLE_FUNC_REGEX: LazyLock<Regex> = LazyLock::new(|| {
Regex::new(r"(?m)^\s*(\w+)\.(\w+)\s*=\s*function\s*\(")
.expect("LUA_TABLE_FUNC_REGEX: hardcoded constant pattern")
});