dsl_knowledge/tables/
mod.rs1pub mod functions;
12pub mod keywords;
13pub mod types;
14
15use crate::entry::Entry;
16use once_cell::sync::Lazy;
17use std::collections::HashMap;
18
19pub fn keywords() -> &'static HashMap<&'static str, Entry> {
20 static MAP: Lazy<HashMap<&'static str, Entry>> = Lazy::new(keywords::build);
21 &MAP
22}
23
24pub fn types() -> &'static HashMap<&'static str, Entry> {
25 static MAP: Lazy<HashMap<&'static str, Entry>> = Lazy::new(types::build);
26 &MAP
27}
28
29pub fn functions() -> &'static HashMap<&'static str, Entry> {
30 static MAP: Lazy<HashMap<&'static str, Entry>> = Lazy::new(functions::build);
31 &MAP
32}
33
34pub fn lookup(token: &str) -> Option<&'static Entry> {
37 let upper = token.to_ascii_uppercase();
38 if let Some(e) = keywords().get(upper.as_str()) {
39 return Some(e);
40 }
41 if let Some(e) = types().get(upper.as_str()) {
42 return Some(e);
43 }
44 let lower = token.to_ascii_lowercase();
45 functions().get(lower.as_str())
46}