AST - Removed unused import, reformatted.

This commit is contained in:
Emmanuel BENOîT 2022-12-31 10:13:51 +01:00
parent 1e122c77a5
commit c0bf521b61

View file

@ -1,4 +1,4 @@
use crate::tokens::{Token, TokenType}; use crate::tokens::Token;
/// This trait should be implemented by nodes to allow AST dumps. /// This trait should be implemented by nodes to allow AST dumps.
pub trait AstDumper { pub trait AstDumper {
@ -45,11 +45,13 @@ impl AstDumper for ExprNode {
Self::Grouping { expression } => { Self::Grouping { expression } => {
format!("( {} )", expression.dump()) format!("( {} )", expression.dump())
} }
Self::Litteral { value } => if value.is_litteral() { Self::Litteral { value } => {
value.lexeme.clone() if value.is_litteral() {
} else { value.lexeme.clone()
panic!("Unexpected token type for token {:#?}", value) } else {
}, panic!("Unexpected token type for token {:#?}", value)
}
}
} }
} }
} }