use decode_derive::SExprDecode;
#[derive(Debug, PartialEq)]
pub struct MixOp(Vec<String>);
impl decode::Decode for MixOp {
fn decode<'a, I: Iterator<Item = &'a sexpr_parse::SExprItem>>(
items: &mut std::iter::Peekable<I>,
) -> decode::Result<Self> {
match items.next() {
Some(sexpr_parse::SExprItem::Text(t)) => {
Ok(MixOp(t.split('%').map(str::to_owned).collect()))
}
Some(item) => Err(decode::Error::cannot_decode_sexpr::<Self>(item)),
None => Err(decode::Error::required_missing_sexpr::<Self>()),
}
}
}
#[allow(unused)]
#[derive(SExprDecode, Debug, PartialEq)]
pub enum SpecTecNum {
#[sexpr_node(name = "nat")]
Nat(u64),
#[sexpr_node(name = "int")]
Int(i64),
#[sexpr_node(name = "rat")]
Rat(String),
#[sexpr_node(name = "real")]
Real(String),
}