better arguments struct, arraylists as values, fixed docgen
This commit is contained in:
+12
-12
@@ -403,9 +403,9 @@ namespace Parser {
|
||||
try assert_type(arguments, Lisp_Object_Type::Pair);
|
||||
try parse_argument_list(arguments, ¯o->value.function);
|
||||
} else {
|
||||
macro->value.function.positional_arguments = create_positional_argument_list(1);
|
||||
macro->value.function.keyword_arguments = create_keyword_argument_list(1);
|
||||
macro->value.function.rest_argument = nullptr;
|
||||
macro->value.function.args.positional = create_positional_argument_list(1);
|
||||
macro->value.function.args.keyword = create_keyword_argument_list(1);
|
||||
macro->value.function.args.rest = nullptr;
|
||||
}
|
||||
|
||||
// arguments = arguments->value.pair.rest;
|
||||
@@ -556,7 +556,7 @@ namespace Parser {
|
||||
|
||||
}
|
||||
|
||||
proc write_expanded_file(String* file_name, Lisp_Object_Array_List* program) -> void {
|
||||
proc write_expanded_file(String* file_name, Lisp_Object_Array_List program) -> void {
|
||||
const char* ext = ".expanded";
|
||||
char* newName = (char*)calloc(10 + file_name->length, sizeof(char));
|
||||
strcpy(newName, Memory::get_c_str(file_name));
|
||||
@@ -573,21 +573,21 @@ namespace Parser {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
for (int i = 0; i < program->next_index; ++i) {
|
||||
for (int i = 0; i < program.next_index; ++i) {
|
||||
// a macro will parse as nil for now, so we skip those
|
||||
if (program->data[i] == Memory::nil)
|
||||
if (program.data[i] == Memory::nil)
|
||||
continue;
|
||||
print(program->data[i], true, f);
|
||||
print(program.data[i], true, f);
|
||||
fprintf(f, "\n\n");
|
||||
}
|
||||
}
|
||||
|
||||
proc parse_program(String* file_name, char* text) -> Lisp_Object_Array_List* {
|
||||
proc parse_program(String* file_name, char* text) -> Lisp_Object_Array_List {
|
||||
parser_file = file_name;
|
||||
parser_line = 1;
|
||||
parser_col = 0;
|
||||
|
||||
Lisp_Object_Array_List* program = create_Lisp_Object_array_list();
|
||||
Lisp_Object_Array_List program = create_Lisp_Object_array_list();
|
||||
|
||||
int index_in_text = 0;
|
||||
|
||||
@@ -595,10 +595,10 @@ namespace Parser {
|
||||
switch (text[index_in_text]) {
|
||||
case '(': {
|
||||
Lisp_Object* parsed;
|
||||
try {
|
||||
try_struct {
|
||||
parsed = parse_expression(text, &index_in_text);
|
||||
}
|
||||
append_to_array_list(program, parsed);
|
||||
append_to_array_list(&program, parsed);
|
||||
} break;
|
||||
case ';':
|
||||
case ' ':
|
||||
@@ -611,7 +611,7 @@ namespace Parser {
|
||||
/* syntax error */
|
||||
create_parsing_error("Garbage in file scope at %s:%d:%d",
|
||||
parser_file, parser_line, parser_col);
|
||||
return nullptr;
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user