diff --git a/bin/pre.slime b/bin/pre.slime index 46a06b9..f838b97 100644 --- a/bin/pre.slime +++ b/bin/pre.slime @@ -1,5 +1,5 @@ (define-syntax when (condition :rest body) - "alsdkjalsk djalksdj alksjd lakjd" + "Doc String for 'when'" `(if ,condition ,(pair prog body) nil)) (define-syntax unless (condition :rest body) @@ -238,4 +238,4 @@ las argument." (eval (pair printf-quoted (extend (list :@sep (eval sep) :@end (eval end)) args)))) (define-syntax pe (expr) - `(printf ,expr "evaluates to" (eval ,expr))) + `(printf ',expr "evaluates to" ,(eval expr))) diff --git a/src/built_ins.cpp b/src/built_ins.cpp index 6c93310..2b695e1 100644 --- a/src/built_ins.cpp +++ b/src/built_ins.cpp @@ -34,17 +34,14 @@ proc built_in_load(String* file_name, Environment* env) -> Lisp_Object* { if (file_content) { Lisp_Object* result = Memory::nil; Lisp_Object_Array_List* program; - try { - program = Parser::parse_program(file_name, file_content); - } + try program = Parser::parse_program(file_name, file_content); + for (int i = 0; i < program->next_index; ++i) { - try { - result = eval_expr(program->data[i], env); - } + try result = eval_expr(program->data[i], env); } return result; } else { - create_generic_error("The file '%s' was not found", file_name); + create_generic_error("The file '%s' was not found", Memory::get_c_str(file_name)); return nullptr; } } diff --git a/src/eval.cpp b/src/eval.cpp index e7c1066..a5f1f38 100644 --- a/src/eval.cpp +++ b/src/eval.cpp @@ -19,7 +19,7 @@ proc apply_arguments_to_function(Lisp_Object* arguments, Function* function) -> String_Array_List* read_in_keywords = create_String_array_list(); - if (Memory::get_type(arguments) == Lisp_Object_Type::Nil) + if (arguments == Memory::nil) goto checks; // keyword arguments: use all given ones and keep track of the // added ones (array list), if end of parameters in encountered or diff --git a/src/testing.cpp b/src/testing.cpp index e3a05af..aaf7884 100644 --- a/src/testing.cpp +++ b/src/testing.cpp @@ -480,14 +480,20 @@ proc test_singular_t_and_nil() -> testresult { proc test_file(const char* file) -> testresult { Memory::reset(); + assert_no_error(); + Environment* env = Memory::create_built_ins_environment(); + assert_no_error(); Parser::init(env); + assert_no_error(); built_in_load(Memory::create_string("pre.slime"), env); - Lisp_Object* result = built_in_load(Memory::create_string(file), env); + assert_no_error(); + Lisp_Object* result = built_in_load(Memory::create_string(file), env); assert_no_error(); + return pass; }