#include "../include/ast.h" Ast ast_none() { Ast ast; ast.value.func_decl = NULL; ast.type = AST_NONE; return ast; } int funcdecl_init(FunctionDecl *self, ScopedAllocator *allocator) { self->name = create_buffer_view_null(); return buffer_init(&self->body, allocator); } int funcdecl_add_to_body(FunctionDecl *self, Ast ast) { return_if_error(buffer_append(&self->body, &ast, sizeof(ast))); return BUFFER_OK; } int funccall_init(FunctionCall *self, BufferView name, ScopedAllocator *allocator) { self->name = name; return buffer_init(&self->args, allocator); } void lhsexpr_init(LhsExpr *self, int isConst, BufferView var_name) { self->isConst = isConst; self->var_name = var_name; self->rhs_expr = ast_none(); } void import_init(Import *self, BufferView path) { self->path = path; } int string_init(String *self, BufferView str) { /* TODO: Convert special characters. For example \n should be converted to binary newline etc */ self->str = str; return 0; } void number_init(Number *self, i64 value, bool is_integer) { self->value.integer = value; self->is_integer = is_integer; }