#![allow(non_upper_case_globals)]
use crate::re::Regex;
use std::sync::LazyLock as Lazy;
pub const M_KEYPRE: i64 = 1;
pub const M_KEYPOST: i64 = 2;
pub const M_VAL: i64 = 4;
pub const S_BKEY: &str = "`$KEY`";
pub const S_BANNO: &str = "`$ANNO`";
pub const S_BEXACT: &str = "`$EXACT`";
pub const S_BVAL: &str = "`$VAL`";
pub const S_BOPEN: &str = "`$OPEN`";
pub const S_DKEY: &str = "$KEY";
pub const S_DTOP: &str = "$TOP";
pub const S_DERRS: &str = "$ERRS";
pub const S_DSPEC: &str = "$SPEC";
pub const S_base: &str = "base";
pub const S_key: &str = "key";
pub const S_nil: &str = "nil";
pub const S_null: &str = "null";
pub const S_string: &str = "string";
pub const S_object: &str = "object";
pub const S_list: &str = "list";
pub const S_map: &str = "map";
pub const S_BT: &str = "`";
pub const S_CN: &str = ":";
pub const S_DS: &str = "$";
pub const S_DT: &str = ".";
pub const S_FS: &str = "/";
pub const S_KEY: &str = "KEY";
pub const S_MT: &str = "";
pub const S_SP: &str = " ";
pub const S_CM: &str = ",";
pub const S_VIZ: &str = ": ";
pub const T_ANY: u32 = (1u32 << 31) - 1; pub const T_NOVAL: u32 = 1 << 30; pub const T_BOOLEAN: u32 = 1 << 29;
pub const T_DECIMAL: u32 = 1 << 28;
pub const T_INTEGER: u32 = 1 << 27;
pub const T_NUMBER: u32 = 1 << 26;
pub const T_STRING: u32 = 1 << 25;
pub const T_FUNCTION: u32 = 1 << 24;
pub const T_SYMBOL: u32 = 1 << 23;
pub const T_NULL: u32 = 1 << 22; pub const T_LIST: u32 = 1 << 14;
pub const T_MAP: u32 = 1 << 13;
pub const T_INSTANCE: u32 = 1 << 12;
pub const T_SCALAR: u32 = 1 << 7;
pub const T_NODE: u32 = 1 << 6;
pub const TYPENAME: [&str; 26] = [
"any", "nil", "boolean", "decimal", "integer", "number", "string", "function", "symbol", "null", "", "", "", "", "", "", "", "list", "map", "instance", "", "", "", "", "scalar", "node", ];
pub const MAXDEPTH: i64 = 32;
pub static R_INTEGER_KEY: Lazy<Regex> = Lazy::new(|| Regex::new(r"^[-0-9]+$").unwrap());
pub static R_ESCAPE_REGEXP: Lazy<Regex> = Lazy::new(|| Regex::new(r"[.*+?^${}()|\[\]\\]").unwrap());
pub static R_QUOTES: Lazy<Regex> = Lazy::new(|| Regex::new(r#"""#).unwrap());
pub static R_DOT: Lazy<Regex> = Lazy::new(|| Regex::new(r"\.").unwrap());
pub static R_CLONE_REF: Lazy<Regex> = Lazy::new(|| Regex::new(r"^`\$REF:([0-9]+)`$").unwrap());
pub static R_META_PATH: Lazy<Regex> = Lazy::new(|| Regex::new(r"^([^$]+)\$([=~])(.+)$").unwrap());
pub static R_TRANSFORM_NAME: Lazy<Regex> = Lazy::new(|| Regex::new(r"`\$([A-Z]+)`").unwrap());
pub static R_INJECTION_FULL: Lazy<Regex> =
Lazy::new(|| Regex::new(r"^`(\$[A-Z]+|[^`]*)[0-9]*`$").unwrap());
pub static R_INJECTION_PARTIAL: Lazy<Regex> = Lazy::new(|| Regex::new(r"`([^`]+)`").unwrap());
pub fn mode_name(mode: i64) -> &'static str {
match mode {
M_VAL => "val",
M_KEYPRE => "key:pre",
M_KEYPOST => "key:post",
_ => "",
}
}
pub fn placement_name(mode: i64) -> &'static str {
match mode {
M_VAL => "value",
M_KEYPRE | M_KEYPOST => "key",
_ => "",
}
}