// Workspace: tablegen // File: tablegen/src/table_structs.rs //! The module `table_structs` contains the base structs needed for the tablegen to function. use phf::phf_map; use regex::Regex; use regex_static::once_cell::sync::Lazy; /// All the type of tsv that can be processed by the program // #[enum_dispatch] #[derive(Clone)] pub enum TableTargets { /// A class tsv Classes, /// Foods tsv Food, /// Alchemy tsv Alchemy, /// Forge tsv Forge, /// MPieges tsv MPieges, /// Weapons tsv Weapons, /// Armors tsv Armors, /// Gadgets tsv Gadgets, /// Potions tsv Potions, /// Traps tsv Traps, } /// A mapping of string names to target types. pub(super) static STR_TO_TARGET_FULL: phf::Map<&'static str, TableTargets> = phf_map! { "cls" => TableTargets::Classes, "fud" => TableTargets::Food, "alc" => TableTargets::Alchemy, "frg" => TableTargets::Forge, "mpi" => TableTargets::MPieges, "wpn" => TableTargets::Weapons, "arm" => TableTargets::Armors, "gdg" => TableTargets::Gadgets, "pot" => TableTargets::Potions, "trp" => TableTargets::Traps, }; /// The regex for finding and replacing all stars with a custom DD pub(super) static RE_STARS: Lazy = regex_static::lazy_regex!(r"★+"); /// The regex for finding and replacing all +/- stars with a custom DD pub(super) static RE_PLUS_STARS: Lazy = regex_static::lazy_regex!(r"([\+-])(★+)"); /// The regex for finding all (+/-) and replacing them with mathmode pub(super) static RE_MATHS: Lazy = regex_static::lazy_regex!(r"\([\+-]+\)");