AST - Use Token.is_litteral() when dumping
This commit is contained in:
parent
ccc6fe0320
commit
faf50ea53e
1 changed files with 4 additions and 4 deletions
|
@ -45,10 +45,10 @@ impl AstDumper for ExprNode {
|
|||
Self::Grouping { expression } => {
|
||||
format!("( {} )", expression.dump())
|
||||
}
|
||||
Self::Litteral { value } => match &value.token_type {
|
||||
TokenType::String(s) => s.clone(),
|
||||
TokenType::Number(n) => format!("{n}"),
|
||||
_ => panic!("Unexpected token type for token {:#?}", value),
|
||||
Self::Litteral { value } => if value.is_litteral() {
|
||||
value.lexeme.clone()
|
||||
} else {
|
||||
panic!("Unexpected token type for token {:#?}", value)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue