diff options
Diffstat (limited to 'src/zisp/io/Parser.zig')
| -rw-r--r-- | src/zisp/io/Parser.zig | 17 |
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); |
