diff --git a/src/interpreter.rs b/src/interpreter.rs index 37679a0..53a7cf6 100644 --- a/src/interpreter.rs +++ b/src/interpreter.rs @@ -14,7 +14,7 @@ // along with this program. If not, see . use crate::element::ScanElement; -use crate::parsers::parse_spec; +use crate::parsers::{parse_spec, Token}; use crate::types::{Action, Context, Entity, Spec}; use jid::Jid; use minidom::{Element, Error as MinidomError}; @@ -99,10 +99,10 @@ pub fn read_actions<'a>(spec: Spec, context: &'a Context) -> Result(buf: &str) -> Spec { - let mut spec = parse_spec(buf).unwrap(); +pub fn read_spec<'a, 'b>(buf: &str) -> Result { + let mut spec = parse_spec(buf)?; spec.context = bind_context(spec.context.clone()); - spec + Ok(spec) } #[cfg(test)]