And other

This commit is contained in:
Adrien Bouvais 2025-01-11 18:03:36 +01:00
parent 90edb94f7a
commit 78213df3ff
3 changed files with 213 additions and 218 deletions

View File

@ -26,20 +26,18 @@ const State = enum {
add_struct,
};
pub const Parser = struct {
toker: *Toker,
allocator: Allocator,
pub const Parser = @This();
toker: *Toker,
allocator: Allocator,
pub fn init(toker: *Toker, allocator: Allocator) Parser {
pub fn init(toker: *Toker, allocator: Allocator) Parser {
return .{
.allocator = allocator,
.toker = toker,
};
}
}
// Rename something better and move it somewhere else
pub fn parse(self: *Parser, struct_array: *std.ArrayList(SchemaStruct)) !void {
pub fn parse(self: *Parser, struct_array: *std.ArrayList(SchemaStruct)) !void {
var state: State = .expect_struct_name_OR_end;
var keep_next = false;
@ -239,7 +237,4 @@ pub const Parser = struct {
else => unreachable,
};
}
};
// TODO: Some test, weird that there isn't any yet
}

View File

@ -55,11 +55,12 @@ pub const ThreadSyncContext = struct {
}
};
pub const ThreadEngine = struct {
thread_arena: *std.heap.ThreadSafeAllocator,
thread_pool: *Pool,
pub const ThreadEngine = @This();
pub fn init() ThreadEngine {
thread_arena: *std.heap.ThreadSafeAllocator,
thread_pool: *Pool,
pub fn init() ThreadEngine {
thread_arena = std.heap.ThreadSafeAllocator{
.child_allocator = allocator,
};
@ -73,9 +74,8 @@ pub const ThreadEngine = struct {
.thread_pool = &thread_pool,
.thread_arena = &thread_arena,
};
}
}
pub fn deinit(_: ThreadEngine) void {
pub fn deinit(_: ThreadEngine) void {
thread_pool.deinit();
}
};
}

View File

@ -1,4 +1,4 @@
pub const Loc = struct {
start: usize,
end: usize,
};
pub const Loc = @This();
start: usize,
end: usize,