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 } => {
|
Self::Grouping { expression } => {
|
||||||
format!("( {} )", expression.dump())
|
format!("( {} )", expression.dump())
|
||||||
}
|
}
|
||||||
Self::Litteral { value } => match &value.token_type {
|
Self::Litteral { value } => if value.is_litteral() {
|
||||||
TokenType::String(s) => s.clone(),
|
value.lexeme.clone()
|
||||||
TokenType::Number(n) => format!("{n}"),
|
} else {
|
||||||
_ => panic!("Unexpected token type for token {:#?}", value),
|
panic!("Unexpected token type for token {:#?}", value)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue