Fix thing

Signed-off-by: xQuantx <[email protected]>
This commit is contained in:
xQuantx
2024-04-03 16:15:16 +02:00
parent fac45a1100
commit 1af6520d39
+2 -3
View File
@@ -22,7 +22,7 @@ pub enum TokenType {
// EOF, // EOF,
} }
#[derive(Clone, Debug)] #[derive(Clone)]
pub struct Token { pub struct Token {
pub token_type: TokenType, pub token_type: TokenType,
pub token_values: Vec<String>, pub token_values: Vec<String>,
@@ -32,7 +32,7 @@ pub struct Token {
impl<'a> fmt::Debug for Token { impl<'a> fmt::Debug for Token {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "(TokenType: {:?}, TokenValue: {})", self.token_type, self.token_values.join(", ")) write!(f, "(TokenType: {:?}, TokenValue: {}, Line: {}, Column {})", self.token_type, self.token_values.join(", "), self.line, self.column)
} }
} }
@@ -105,7 +105,6 @@ pub fn lex(mut code: &str, use_whitespace: bool) -> Vec<Token> {
line: state.line, line: state.line,
column: state.column column: state.column
}); });
println!("token found {:#?}", tokens.get(tokens.len()-1));
} }
match s.token_type { match s.token_type {