Compare commits

..

No commits in common. "fe4ab556f8e310361bf13643f6333b2c929ce7e9" and "589649298c1925fbf1cd1ac2e7bfac03dcbc0da3" have entirely different histories.

3 changed files with 82 additions and 118 deletions

View file

@ -1,3 +1,3 @@
[toolchain] [toolchain]
channel = "nightly-2023-09-17" channel = "nightly"
components = ["rust-src", "llvm-tools"] components = ["rust-src", "llvm-tools"]

View file

@ -19,7 +19,7 @@ impl Config<'static> {
let mut engine = Engine::new(); let mut engine = Engine::new();
let mut scope = Scope::new(); let mut scope = Scope::new();
let ast = engine let ast = engine
.compile_file(PathBuf::from_str("/home/able/Projects/adit/assets/config.rhai").unwrap()) .compile_file(PathBuf::from_str("assets/config.rhai").unwrap())
.unwrap(); .unwrap();
let result = engine.call_fn::<Dynamic>(&mut scope, &ast, "status_bar", ()); let result = engine.call_fn::<Dynamic>(&mut scope, &ast, "status_bar", ());

View file

@ -32,11 +32,7 @@ impl FileType {
&self.hl_opts &self.hl_opts
} }
pub fn from(file_name: &str) -> Self { pub fn from(file_name: &str) -> Self {
let ext = file_name.split('.').last(); if file_name.ends_with(".rs") {
if ext.is_some() {
let ext = ext.unwrap();
match ext {
"rs" => {
return Self { return Self {
name: String::from("Rust"), name: String::from("Rust"),
hl_opts: HighlightingOptions { hl_opts: HighlightingOptions {
@ -115,40 +111,8 @@ impl FileType {
"f64".to_string(), "f64".to_string(),
], ],
}, },
}
}
"hb" => {
return Self {
name: String::from("HBLang"),
hl_opts: HighlightingOptions {
numbers: true,
strings: true,
characters: true,
comments: true,
multiline_comments: true,
primary_keywords: vec![
"if".to_string(),
"else".to_string(),
"return".to_string(),
"loop".to_string(),
"break".to_string(),
"struct".to_string(),
],
secondary_keywords: vec![
":=".to_string(),
"void".to_string(),
"never".to_string(),
"int".to_string(),
"bool".to_string(),
],
},
}; };
} }
_ => return Self::default(),
}
}
Self::default() Self::default()
} }
} }