summaryrefslogtreecommitdiff
path: root/src/zisp/io/Parser.zig
diff options
context:
space:
mode:
authorTaylan Kammer <taylan.kammer@gmail.com>2026-08-16 10:01:12 +0200
committerTaylan Kammer <taylan.kammer@gmail.com>2026-08-16 10:01:12 +0200
commite26e81aa33dc1ecc2f26de26b1d420d288a28493 (patch)
treed0c906f3b6d504870a171f57709c6e912a3fc9c4 /src/zisp/io/Parser.zig
parent0e073b94c90b78ebe156adb27ec4456e86935d42 (diff)
Implemented meta allocator.
Diffstat (limited to 'src/zisp/io/Parser.zig')
-rw-r--r--src/zisp/io/Parser.zig17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/zisp/io/Parser.zig b/src/zisp/io/Parser.zig
index b1db437..0a64698 100644
--- a/src/zisp/io/Parser.zig
+++ b/src/zisp/io/Parser.zig
@@ -45,10 +45,9 @@ const lib = @import("../lib.zig");
const value = @import("../value.zig");
const ListPool = gc.ListPool;
-const IstrSet = gc.IstrSet;
+const IstrPool = gc.IstrPool;
const Decoder = io.Decoder;
const Value = value.Value;
-const IstrPtr = value.istr.IstrPtr;
const Parser = @This();
@@ -98,7 +97,7 @@ pub const Context = struct {
};
list_pool: ?*ListPool,
-istr_set: ?*IstrSet,
+istr_pool: ?*IstrPool,
alloc: Alloc,
ctx_stack: List(Context),
str_chars: List(u8),
@@ -113,15 +112,15 @@ err_msg: []const u8 = undefined,
pub fn init() !Parser {
const list_pool = gc.mainListPool();
- const istr_set = gc.mainIstrSet();
+ const istr_pool = gc.mainIstrPool();
const alloc = gc.mainAlloc();
const decoder = io.mainDecoder();
- return initCustom(list_pool, istr_set, alloc, 16, 512, 32, decoder);
+ return initCustom(list_pool, istr_pool, alloc, 16, 512, 32, decoder);
}
pub fn initCustom(
list_pool: ?*ListPool,
- istr_set: ?*IstrSet,
+ istr_pool: ?*IstrPool,
alloc: Alloc,
init_ctx_stack_cap: usize,
init_str_chars_cap: usize,
@@ -134,7 +133,7 @@ pub fn initCustom(
const lst_cap = @max(2, init_list_elts_cap);
return .{
.list_pool = list_pool,
- .istr_set = istr_set,
+ .istr_pool = istr_pool,
.alloc = alloc,
.ctx_stack = try .initCapacity(alloc, ctx_cap),
.str_chars = try .initCapacity(alloc, str_cap),
@@ -229,8 +228,8 @@ fn getCharsAsString(p: *Parser) !Value {
}
}
-fn getIstr(p: *Parser, s: []const u8) !IstrPtr {
- if (p.istr_set) |set| {
+fn getIstr(p: *Parser, s: []const u8) !Value {
+ if (p.istr_pool) |set| {
return try value.istr.getOrNewInSet(set, s);
} else {
return try value.istr.new(p.alloc, s);