Clean up
This commit is contained in:
parent
dab3d2de8e
commit
ca04103372
@ -129,13 +129,13 @@ impl Interpreter {
|
|||||||
/// This function [parses][Self::parse], [validates][Self::validate] and
|
/// This function [parses][Self::parse], [validates][Self::validate] and
|
||||||
/// [runs][Root::run] using the same source code.
|
/// [runs][Root::run] using the same source code.
|
||||||
pub fn run(&mut self, source: &str) -> Result<Value, Error> {
|
pub fn run(&mut self, source: &str) -> Result<Value, Error> {
|
||||||
self.validate(source)?
|
let final_value = self.validate(source)?.run(source, &self.context)?;
|
||||||
.run(source, &self.context)
|
|
||||||
.map_err(|error| Error::Runtime(error))
|
Ok(final_value)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return an s-expression displaying a syntax tree of the source, or the
|
/// Return an s-expression displaying a syntax tree of the source or an
|
||||||
/// ParserCancelled error if the parser takes too long.
|
/// error.
|
||||||
pub fn syntax_tree(&mut self, source: &str) -> Result<String, Error> {
|
pub fn syntax_tree(&mut self, source: &str) -> Result<String, Error> {
|
||||||
Ok(self.parse(source)?.root_node().to_sexp())
|
Ok(self.parse(source)?.root_node().to_sexp())
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user