print list
This commit is contained in:
parent
8534fb4118
commit
107897ec97
@ -3,6 +3,7 @@ use schala_lib::{ProgrammingLanguageInterface, EvalOptions, ReplOutput};
|
|||||||
use std::iter::Peekable;
|
use std::iter::Peekable;
|
||||||
use std::vec::IntoIter;
|
use std::vec::IntoIter;
|
||||||
use std::str::Chars;
|
use std::str::Chars;
|
||||||
|
use std::fmt::Write;
|
||||||
|
|
||||||
pub struct EvaluatorState { }
|
pub struct EvaluatorState { }
|
||||||
|
|
||||||
@ -104,7 +105,15 @@ impl Sexp {
|
|||||||
&SymbolAtom(ref sym) => format!("{}", sym),
|
&SymbolAtom(ref sym) => format!("{}", sym),
|
||||||
&StringAtom(ref s) => format!("\"{}\"", s),
|
&StringAtom(ref s) => format!("\"{}\"", s),
|
||||||
&NumberAtom(ref n) => format!("{}", n),
|
&NumberAtom(ref n) => format!("{}", n),
|
||||||
&List(ref sexprs) => format!("<unprintable>"),
|
&List(ref sexprs) => {
|
||||||
|
let mut output = String::new();
|
||||||
|
write!(&mut output, "(");
|
||||||
|
for sexpr in sexprs.iter() {
|
||||||
|
write!(&mut output, "{}", sexpr.print());
|
||||||
|
}
|
||||||
|
write!(&mut output, ")");
|
||||||
|
output
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user