This commit is contained in:
Parker TenBroeck 2026-01-05 14:46:47 -05:00
parent f1b8c08e8f
commit 7971c61c74
15 changed files with 41485 additions and 252 deletions

View file

@ -142,6 +142,7 @@ pub fn lex(input: &str) -> Vec<Tok> {
| "sigma",
) => Kind::Keyword,
Token::Ident(_) => Kind::Ident,
Token::LineEnd => Kind::Punc,
};
let scope_level = match kind {
@ -183,7 +184,7 @@ pub struct CompileLog {
}
#[wasm_bindgen(getter_with_clone)]
pub struct CompileResult{
pub struct CompileResult {
pub log: Vec<CompileLog>,
pub log_formatted: String,
}
@ -196,9 +197,13 @@ pub fn compile(input: &str) -> CompileResult {
};
use std::fmt::Write;
let log_formatted = log.displayable().fold(String::new(), |mut s, e|{write!(&mut s, "{e}").unwrap(); s});
let log_formatted = log.displayable().fold(String::new(), |mut s, e| {
write!(&mut s, "{e}").unwrap();
s
});
let log = log.into_entries()
let log = log
.into_entries()
.map(|e| CompileLog {
level: match e.level {
loader::log::LogLevel::Info => LogLevel::Info,