diff options
| author | Anhgelus Morhtuuzh <william@herges.fr> | 2026-04-16 20:26:44 +0200 |
|---|---|---|
| committer | Anhgelus Morhtuuzh <william@herges.fr> | 2026-04-16 20:29:55 +0200 |
| commit | 11cc71f3b59fa62fd2fb2cb3b84e689317fb1268 (patch) | |
| tree | f9ffe208db23e3bb79d70ea7f424422d8fade16d /src/lexer/lexed.zig | |
| parent | 4ce2a56b2e76b631bae5f845e310e3f46dde4dbe (diff) | |
refactor(lexer): flatten struct
Diffstat (limited to 'src/lexer/lexed.zig')
| -rw-r--r-- | src/lexer/lexed.zig | 44 |
1 files changed, 21 insertions, 23 deletions
diff --git a/src/lexer/lexed.zig b/src/lexer/lexed.zig index 63395bb..b7c3b2c 100644 --- a/src/lexer/lexed.zig +++ b/src/lexer/lexed.zig @@ -21,31 +21,29 @@ pub const Kind = enum { tag, }; -pub const Lexed = struct { - allocator: Allocator, - kind: Kind, - content: std.ArrayList(u8), +allocator: Allocator, +kind: Kind, +content: std.ArrayList(u8), - const Self = @This(); +const Self = @This(); - pub fn init(alloc: Allocator, kind: Kind, content: std.ArrayList(u8)) Lexed { - return Lexed{ - .allocator = alloc, - .kind = kind, - .content = content, - }; - } +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 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 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); - } -}; +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); +} |
