format infinite float as the ∞ utf8 symbol

This commit is contained in:
Folkert 2024-01-28 20:47:55 +01:00
parent 4a593a5b77
commit 0b0127f45e
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
2 changed files with 14 additions and 1 deletions

View file

@ -1484,5 +1484,12 @@ fn number_literal_to_ast<T: std::fmt::Display>(arena: &Bump, num: T) -> Expr<'_>
let mut string = bumpalo::collections::String::with_capacity_in(64, arena);
write!(string, "{num}").unwrap();
Expr::Num(string.into_bump_str())
if string == "inf" {
Expr::Num("")
} else if string == "-inf" {
Expr::Num("-∞")
} else {
Expr::Num(string.into_bump_str())
}
}