use crate::scanner::Scanner;
use color_eyre::eyre::Result;
pub fn compile(source: &str) -> Result<()> {
let mut scanner = Scanner::new(source);
let mut line = None;
for token in &mut scanner {
if Some(token.line) != line {
print!("{:4} ", token.line);
line = Some(token.line);
} else {
print!(" | ");
}
println!("{:2?} '{}'", token.kind, token.value);
}
Ok(())
}