poco_scheme/
lib.rs

1macro_rules! make_error {
2    ($fmt:literal, $($fmtargs:expr),*) => {
3        $crate::Value::Exception(Box::new($crate::value::Exception {
4            message: format!($fmt, $($fmtargs),*),
5            irritants: Vec::new(),
6        }))
7    };
8    ($fmt:literal; $($irritants:expr),*) => {
9        $crate::Value::Exception(Box::new($crate::value::Exception {
10            message: $fmt.into(),
11            irritants: vec![$($irritants),*],
12        }))
13    };
14    ($fmt:literal, $($fmtargs:expr),*; $($irritants:expr),*) => {
15        $crate::Value::Exception(Box::new($crate::value::Exception {
16            message: format!($fmt, $($fmtargs),*),
17            irritants: vec![$($irritants),*],
18        }))
19    };
20}
21
22macro_rules! try_value {
23    ($expr:expr) => {{
24        let v = $expr;
25        if let Value::Exception(_) = v {
26            return v.into();
27        } else {
28            v
29        }
30    }};
31}
32
33macro_rules! try_result {
34    ($expr:expr) => {
35        match $expr {
36            Ok(v) => v,
37            Err(e) => return e.into(),
38        }
39    };
40}
41
42mod ast;
43mod prim;
44mod util;
45mod value;
46mod vm;
47
48pub use value::{PrimOp, Value};
49pub use vm::{EvalError, Vm};