colorful printing

This commit is contained in:
2024-04-08 14:09:59 +02:00
parent c915c99d06
commit 3e41b5f3ac
3 changed files with 21 additions and 9 deletions
+1 -1
View File
@@ -41,7 +41,7 @@ impl fmt::Debug for Token {
impl fmt::Display for Token {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "(TokenType: {:?}, TokenValue: {}, Line: {}, Column {})", self.token_type, self.value, self.line, self.column)
write!(f, "(\x1b[33mTokenType:\x1b[0m \x1b[35m{:?}\x1b[0m, \x1b[33mTokenValue:\x1b[0m \x1b[32m\"{}\"\x1b[0m, \x1b[33mLine:\x1b[0m \x1b[36m{}\x1b[0m, \x1b[33mColumn:\x1b[0m \x1b[36m{}\x1b[0m)", self.token_type, self.value, self.line, self.column)
}
}