diff options
| author | Nathan Reiner <nathan@nathanreiner.xyz> | 2025-05-06 10:43:09 +0200 |
|---|---|---|
| committer | Nathan Reiner <nathan@nathanreiner.xyz> | 2025-05-06 10:43:09 +0200 |
| commit | eff19cc15a9bf4df60e7f90c3a7ee525c65266c0 (patch) | |
| tree | d6034b574e8e2218054d42caadbf25fa17862abf /src/char-set.zig | |
| parent | e2f01d5df22704bfe62396a0f9a260f86edbde0e (diff) | |
add full grammar parsing
Diffstat (limited to 'src/char-set.zig')
| -rw-r--r-- | src/char-set.zig | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/char-set.zig b/src/char-set.zig index d244540..55c719c 100644 --- a/src/char-set.zig +++ b/src/char-set.zig @@ -4,7 +4,7 @@ const Character = @import("character.zig").Character; const Self = @This(); -charset: [256]bool = std.mem.zeroes([256]bool), +charset: [258]bool = std.mem.zeroes([258]bool), pub inline fn is_set(self: *const Self, c: usize) bool { return self.charset[c]; @@ -48,8 +48,8 @@ pub fn format( try writer.print("}}", .{}); } -pub fn expect(self: *const Self, expected: []const u8) !void { - var matrix = std.mem.zeroes([255]bool); +pub fn expect(self: *const Self, expected: []const u9) !void { + var matrix = std.mem.zeroes([258]bool); for (expected) |c| { matrix[c] = true; @@ -65,7 +65,7 @@ pub fn expect(self: *const Self, expected: []const u8) !void { } else if (c == Character.END) { std.debug.print("$ ", .{}); } else { - std.debug.print("'{c}' ", .{c}); + std.debug.print("'{c}' ", .{@as(u8, @truncate(c))}); } } |