+2
-3
@@ -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 {
|
||||||
|
|||||||
Reference in New Issue
Block a user