Implement builtin functions `quote` and `unquote`
use std::collections::BTreeMap;
use super::Builtin;
+use crate::common::QuoteKind;
use crate::units::Unit;
use crate::value::{Number, Value};
@@ -26,4 +27,14 @@ pub(crate) fn register(f: &mut BTreeMap<String, Builtin>) {
_ => todo!("")
}
});
+ decl!(f "quote", |args, _| {
+ let s = arg!(args, 0, "string").eval();
+ match s {
+ Value::Ident(i, _) => Some(Value::Ident(i, QuoteKind::Double)),
+ _ => todo!("")
+ }
+ });
+ decl!(f "unquote", |args, _| {
+ Some(arg!(args, 0, "string").eval().unquote())
+ });
}
