Add quote special form

This commit is contained in:
2022-11-04 22:03:47 -04:00
parent 2344a7d498
commit 2527c34ddf
3 changed files with 6 additions and 2 deletions

View File

@@ -19,10 +19,9 @@ int main(int argc, const char **argv) {
ucl_state_put(state, "lambda", ucl_special_create(ucl_special_lambda)); ucl_state_put(state, "lambda", ucl_special_create(ucl_special_lambda));
ucl_state_put(state, "setq", ucl_special_create(ucl_special_setq)); ucl_state_put(state, "setq", ucl_special_create(ucl_special_setq));
ucl_state_put(state, "progn", ucl_special_create(ucl_special_progn)); ucl_state_put(state, "progn", ucl_special_create(ucl_special_progn));
ucl_state_put(state, "quote", ucl_special_create(ucl_special_quote));
// TODO: // TODO:
// - progn
// - quote
// - iteration // - iteration
ucl_state_put(state, "print", ucl_builtin_create(ucl_builtin_print)); ucl_state_put(state, "print", ucl_builtin_create(ucl_builtin_print));

View File

@@ -101,3 +101,7 @@ struct ucl_object *ucl_special_setq(struct ucl_state *state, struct ucl_object *
struct ucl_object *ucl_special_progn(struct ucl_state *state, struct ucl_object *args) { struct ucl_object *ucl_special_progn(struct ucl_state *state, struct ucl_object *args) {
return ucl_progn(state, args); return ucl_progn(state, args);
} }
struct ucl_object *ucl_special_quote(struct ucl_state *state, struct ucl_object *args) {
return ucl_car(args);
}

View File

@@ -9,5 +9,6 @@ struct ucl_object *ucl_special_defun(struct ucl_state *state, struct ucl_object
struct ucl_object *ucl_special_lambda(struct ucl_state *state, struct ucl_object *args); struct ucl_object *ucl_special_lambda(struct ucl_state *state, struct ucl_object *args);
struct ucl_object *ucl_special_setq(struct ucl_state *state, struct ucl_object *args); struct ucl_object *ucl_special_setq(struct ucl_state *state, struct ucl_object *args);
struct ucl_object *ucl_special_progn(struct ucl_state *state, struct ucl_object *args); struct ucl_object *ucl_special_progn(struct ucl_state *state, struct ucl_object *args);
struct ucl_object *ucl_special_quote(struct ucl_state *state, struct ucl_object *args);
#endif #endif