From e7fa254387e450154f03b2d1bdef361a0adb80d1 Mon Sep 17 00:00:00 2001 From: Anhgelus Morhtuuzh Date: Fri, 24 Apr 2026 17:40:33 +0200 Subject: perf(lexer): do not alloc --- src/lexer/Lexed.zig | 57 ----------------------------------------------------- 1 file changed, 57 deletions(-) delete mode 100644 src/lexer/Lexed.zig (limited to 'src/lexer/Lexed.zig') diff --git a/src/lexer/Lexed.zig b/src/lexer/Lexed.zig deleted file mode 100644 index 46fd552..0000000 --- a/src/lexer/Lexed.zig +++ /dev/null @@ -1,57 +0,0 @@ -const std = @import("std"); -const Allocator = std.mem.Allocator; - -pub const Kind = enum { - literal, - weak_delimiter, - strong_delimiter, - title, - quote, - code, - code_block, - math, - math_block, - image, - link, - bold, - italic, - ref, - callout, - list_ordored, - list_unordored, - tag, - - pub fn isDelimiter(self: @This()) bool { - return switch (self) { - .weak_delimiter, .strong_delimiter => true, - else => false, - }; - } -}; - -allocator: Allocator, -kind: Kind, -content: std.ArrayList(u8), - -const Self = @This(); - -pub fn init(alloc: Allocator, kind: Kind, content: std.ArrayList(u8)) Self { - return .{ - .allocator = alloc, - .kind = kind, - .content = content, - }; -} - -pub fn deinit(self: *Self) void { - self.content.deinit(self.allocator); -} - -pub fn clone(self: *const Self, alloc: Allocator) Allocator.Error!std.ArrayList(u8) { - return self.content.clone(alloc); -} - -pub fn equals(self: *const Self, kind: Kind, content: []const u8) bool { - if (self.kind != kind) return false; - return std.mem.eql(u8, self.content.items, content); -} -- cgit v1.2.3