interpreter: return Result<Spec, Token> in read_spec
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
parent
934376e974
commit
9f5f45aafe
1 changed files with 4 additions and 4 deletions
|
@ -14,7 +14,7 @@
|
|||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
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<InOutStanza<
|
|||
Ok(inout)
|
||||
}
|
||||
|
||||
pub fn read_spec<'a>(buf: &str) -> Spec {
|
||||
let mut spec = parse_spec(buf).unwrap();
|
||||
pub fn read_spec<'a, 'b>(buf: &str) -> Result<Spec, Token> {
|
||||
let mut spec = parse_spec(buf)?;
|
||||
spec.context = bind_context(spec.context.clone());
|
||||
spec
|
||||
Ok(spec)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
|
Loading…
Reference in a new issue