cl-ast: Escape string and char literals when pretty-printing
This commit is contained in:
parent
e43847bbd4
commit
38a5d31b08
@ -48,9 +48,9 @@ mod display {
|
|||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
match self {
|
match self {
|
||||||
Literal::Bool(v) => v.fmt(f),
|
Literal::Bool(v) => v.fmt(f),
|
||||||
Literal::Char(v) => write!(f, "'{v}'"),
|
Literal::Char(v) => write!(f, "'{}'", v.escape_debug()),
|
||||||
Literal::Int(v) => v.fmt(f),
|
Literal::Int(v) => v.fmt(f),
|
||||||
Literal::String(v) => write!(f, "\"{v}\""),
|
Literal::String(v) => write!(f, "\"{}\"", v.escape_debug()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user