v0.3.0 #1
@ -58,12 +58,12 @@ mod args {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mod repl {
|
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 super::*;
|
||||||
use msp430_asm::cursor::*;
|
use msp430_asm::cursor::*;
|
||||||
use std::io::{stderr, Write};
|
use std::io::{stderr, Write};
|
||||||
|
|
||||||
/// Prints the line number
|
/// Formats the line number
|
||||||
macro linenr($n: expr) {
|
macro linenr($n: expr) {
|
||||||
format_args!("{:4}: ", $n)
|
format_args!("{:4}: ", $n)
|
||||||
}
|
}
|
||||||
@ -97,13 +97,13 @@ mod repl {
|
|||||||
line.clear();
|
line.clear();
|
||||||
printfl!("{}", linenr!(linenr));
|
printfl!("{}", linenr!(linenr));
|
||||||
}
|
}
|
||||||
println!("{}", fg!(Gray, "[EOF]"));
|
println!("{}", fg!(DarkGray, "[EOF]"));
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Rewrites the line in OK format, with a green linenr
|
/// Rewrites the line in OK format, with a green linenr
|
||||||
fn format_ok(line: &str, linenr: i32) {
|
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
|
/// Pretty-prints a line error
|
||||||
|
Loading…
Reference in New Issue
Block a user