msp430-asm: Make UI a little bet prettier

This commit is contained in:
John 2024-02-01 12:00:55 -06:00
parent f6c1914720
commit 618200dc42

View File

@ -58,12 +58,12 @@ mod args {
}
mod repl {
//! The REPL reads a line, parses it, evaluates the line, and prints, in a loop
//! The REPL reads, evaluates, and prints in a loop
use super::*;
use msp430_asm::cursor::*;
use std::io::{stderr, Write};
/// Prints the line number
/// Formats the line number
macro linenr($n: expr) {
format_args!("{:4}: ", $n)
}
@ -97,13 +97,13 @@ mod repl {
line.clear();
printfl!("{}", linenr!(linenr));
}
println!("{}", fg!(Gray, "[EOF]"));
println!("{}", fg!(DarkGray, "[EOF]"));
Ok(())
}
/// Rewrites the line in OK format, with a green linenr
fn format_ok(line: &str, linenr: i32) {
println!("{}{}{}", previous!(1), fg!(Green, "{:4}", linenr!(linenr)), line.trim_end(),);
println!("{}{}{}", previous!(1), fg!(Lime, "{:4}", linenr!(linenr)), line.trim_end(),);
}
/// Pretty-prints a line error