WIP: even more crazy linux optimizations
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
use ratatui::style::{Modifier, Style};
|
||||
|
||||
use crate::model::{SourceSpan, WordCompile, WORDS};
|
||||
use crate::model::{lookup_word, SourceSpan, WordCompile};
|
||||
use crate::theme;
|
||||
|
||||
#[derive(Clone, Copy, PartialEq, Eq)]
|
||||
@@ -73,27 +73,23 @@ fn lookup_word_kind(word: &str) -> Option<(TokenKind, bool)> {
|
||||
return Some((TokenKind::Emit, true));
|
||||
}
|
||||
|
||||
for w in WORDS {
|
||||
if w.name == word || w.aliases.contains(&word) {
|
||||
let kind = match &w.compile {
|
||||
WordCompile::Param => TokenKind::Param,
|
||||
WordCompile::Context(_) => TokenKind::Context,
|
||||
_ => match w.category {
|
||||
"Stack" => TokenKind::StackOp,
|
||||
"Arithmetic" | "Comparison" | "Music" => TokenKind::Operator,
|
||||
"Logic" if matches!(w.name, "and" | "or" | "not" | "xor" | "nand" | "nor") => {
|
||||
TokenKind::Operator
|
||||
}
|
||||
"Sound" => TokenKind::Sound,
|
||||
"Randomness" | "Probability" | "Selection" => TokenKind::Vary,
|
||||
"Generator" => TokenKind::Generator,
|
||||
_ => TokenKind::Keyword,
|
||||
},
|
||||
};
|
||||
return Some((kind, w.varargs));
|
||||
}
|
||||
}
|
||||
None
|
||||
let w = lookup_word(word)?;
|
||||
let kind = match &w.compile {
|
||||
WordCompile::Param => TokenKind::Param,
|
||||
WordCompile::Context(_) => TokenKind::Context,
|
||||
_ => match w.category {
|
||||
"Stack" => TokenKind::StackOp,
|
||||
"Arithmetic" | "Comparison" | "Music" => TokenKind::Operator,
|
||||
"Logic" if matches!(w.name, "and" | "or" | "not" | "xor" | "nand" | "nor") => {
|
||||
TokenKind::Operator
|
||||
}
|
||||
"Sound" => TokenKind::Sound,
|
||||
"Randomness" | "Probability" | "Selection" => TokenKind::Vary,
|
||||
"Generator" => TokenKind::Generator,
|
||||
_ => TokenKind::Keyword,
|
||||
},
|
||||
};
|
||||
Some((kind, w.varargs))
|
||||
}
|
||||
|
||||
fn is_note(word: &str) -> bool {
|
||||
|
||||
Reference in New Issue
Block a user