Implement builtin functions quote
and unquote
This commit is contained in:
parent
22670a7e4b
commit
86173a3ca7
@ -1,6 +1,7 @@
|
||||
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())
|
||||
});
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user