circuit handles load commands better

Signed-off-by: Ava Hahn <ava@sunnypup.io>
This commit is contained in:
Ava Apples Affine 2023-03-27 14:34:07 -07:00
parent 921deb9e5e
commit ab14ba4b5e
Signed by: affine
GPG key ID: 3A4645B8CF806069
7 changed files with 43 additions and 14 deletions

View file

@ -314,10 +314,14 @@ pub fn circuit_callback(ast: &Seg, syms: &mut SymTable) -> Result<Ctr, String> {
Ctr::Seg(s) if expand_eval_res => {
if let Ctr::Bool(b) = *s.car {
return b;
} else if let Ctr::Integer(i) = *s.car {
return i==0;
} else {
error = "impossible condition in circuit form".to_string();
}
}
},
Ctr::Integer(i) => return i == 0,
_ => error = format!("{cursor} form did not evaluate to a boolean"),
},