AST - Removed unused import, reformatted.
This commit is contained in:
parent
1e122c77a5
commit
c0bf521b61
1 changed files with 8 additions and 6 deletions
|
@ -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 } => {
|
||||||
|
if value.is_litteral() {
|
||||||
value.lexeme.clone()
|
value.lexeme.clone()
|
||||||
} else {
|
} else {
|
||||||
panic!("Unexpected token type for token {:#?}", value)
|
panic!("Unexpected token type for token {:#?}", value)
|
||||||
},
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue