pub fn grammar_for(syntax: &str) -> &'static [(&'static str, &'static [&'static str])] { match syntax { "rs" => &[ ( "keyword", &[ "fn", "pub", "async", "return", "if", "else", "let", "for", "while", "loop", "impl", "for", "trait", "struct", "enum", ], ), ( "type", &[ "[A-Z][a-z]*", "bool", "usize", "u8", "u16", "u32", "u64", "u128", "i8", "i16", "i32", "i64", "i128", "isize", "f32", "f64", ], ), ("comment", &["(?m)(//.*)$", "(?ms)/\\*.*?\\*/"]), ("macro", &["([a-z_][A-Za-z0-9_]*!)\\s*"]), ("identifier", &["([a-z_][A-Za-z0-9_]*)\\s*\\("]), ("literal", &["\".*?\"", "\\d", "true", "false"]), ], "tree" => &[("keyword", &["[├─└│]+"])], // makefile doesnt really match the token-kinds, i'll just use something that looks goo "makefile" => &[ ("comment", &["(?m)(#.*)$"]), ("literal", &[".+:"]), ("macro", &["\\$\\(\\w+\\)"]), ("type", &["\\$@", "\\$<"]), ], _ => &[], } }