Compare commits
2 commits
589649298c
...
fe4ab556f8
Author | SHA1 | Date | |
---|---|---|---|
able | fe4ab556f8 | ||
able | d836f2f145 |
|
@ -1,3 +1,3 @@
|
||||||
[toolchain]
|
[toolchain]
|
||||||
channel = "nightly"
|
channel = "nightly-2023-09-17"
|
||||||
components = ["rust-src", "llvm-tools"]
|
components = ["rust-src", "llvm-tools"]
|
||||||
|
|
|
@ -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("assets/config.rhai").unwrap())
|
.compile_file(PathBuf::from_str("/home/able/Projects/adit/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", ());
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,11 @@ impl FileType {
|
||||||
&self.hl_opts
|
&self.hl_opts
|
||||||
}
|
}
|
||||||
pub fn from(file_name: &str) -> Self {
|
pub fn from(file_name: &str) -> Self {
|
||||||
if file_name.ends_with(".rs") {
|
let ext = file_name.split('.').last();
|
||||||
|
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 {
|
||||||
|
@ -111,8 +115,40 @@ 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()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue