mirror of
https://github.com/Kindelia/Kind2.git
synced 2024-10-06 04:17:14 +03:00
Fix stringifier
This commit is contained in:
parent
acab6d95b8
commit
5c07dd97e8
@ -1893,9 +1893,14 @@ pub fn interpret_as_string(term: &Term) -> Option<String> {
|
||||
if let Term::Ctr { name, args, .. } = term {
|
||||
if name == "String.cons" && args.len() == 2 {
|
||||
if let Term::Num { numb, .. } = *args[0] {
|
||||
let chr = ascii::escape_default(numb as u8).to_string();
|
||||
text.push_str(&chr);
|
||||
term = &*args[1];
|
||||
// TODO: In the future we will just have to push the str to the text
|
||||
// if the parser accepts escaped chars.
|
||||
if ascii::escape_default(numb as u8).count() > 1 {
|
||||
return None
|
||||
} else {
|
||||
text.push(char::from_u32(numb as u32).unwrap_or('\0'));
|
||||
term = &*args[1];
|
||||
}
|
||||
} else {
|
||||
return None;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user