initial commit

This commit is contained in:
2025-12-22 23:04:20 +01:00
parent 5821a7f929
commit 977d05f15d
13 changed files with 320 additions and 0 deletions

33
src/WordIterator.zig git.filemode.normal_file
View File

@@ -0,0 +1,33 @@
const lib = @import("lib.zig");
const SpvWord = lib.SpvWord;
const Self = @This();
buffer: []const SpvWord,
index: usize,
pub fn init(buffer: []const SpvWord) Self {
return .{
.buffer = buffer,
.index = 0,
};
}
pub fn next(self: *Self) ?SpvWord {
const word = self.peek() orelse return null;
self.index += 1;
return word;
}
pub fn peek(self: *const Self) ?SpvWord {
return if (self.index >= self.buffer.len) null else self.buffer[self.index];
}
pub fn skip(self: *Self) bool {
if (self.index >= self.buffer.len) {
return false;
}
self.index += 1;
return true;
}