ast: formatting; main: explicit verbosity
This commit is contained in:
@@ -205,7 +205,10 @@ fn subst() -> Result<(), Box<dyn Error>> {
|
||||
|
||||
fn parse(document: &str) {
|
||||
let mut parser = Parser::new(Lexer::new(document));
|
||||
let isatty = std::io::stdin().is_terminal();
|
||||
let verbose = !matches!(
|
||||
std::env::var("DOUGHLANG_VERBOSE").as_deref(),
|
||||
Ok("false" | "0" | "no")
|
||||
);
|
||||
for idx in 0.. {
|
||||
match parser.parse::<Expr>(0) {
|
||||
Err(e @ ParseError::EOF(s)) if s.tail == document.len() as _ => {
|
||||
@@ -220,7 +223,7 @@ fn parse(document: &str) {
|
||||
println!("\x1b[91m{e}\x1b[0m");
|
||||
break;
|
||||
}
|
||||
Ok(v) if isatty => {
|
||||
Ok(v) if verbose => {
|
||||
println!("\x1b[{}m{v}", (idx + 5) % 6 + 31);
|
||||
}
|
||||
_ => {}
|
||||
|
||||
Reference in New Issue
Block a user