Skip to content

Commit 7064a79

Browse files
committed
wip
1 parent 2bf8f4d commit 7064a79

29 files changed

+281
-405
lines changed

build.zig

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,22 @@ pub fn build(b: *std.Build) !void {
6464
if (version == .tag) {
6565
setupReleaseStep(b, options, superhtml, folders, lsp);
6666
}
67+
68+
setupGeneratorStep(b, target);
69+
}
70+
71+
fn setupGeneratorStep(b: *std.Build, target: std.Build.ResolvedTarget) void {
72+
const gen = b.step("generator", "Build generator executable for reproing fuzz cases");
73+
const supergen = b.addExecutable(.{
74+
.name = "generator",
75+
.root_module = b.createModule(.{
76+
.root_source_file = b.path("src/generator.zig"),
77+
.target = target,
78+
.optimize = .ReleaseSafe,
79+
}),
80+
});
81+
82+
gen.dependOn(&b.addInstallArtifact(supergen, .{}).step);
6783
}
6884

6985
fn setupCheckStep(
@@ -106,8 +122,7 @@ fn setupTestStep(
106122

107123
const unit_tests = b.addTest(.{
108124
.root_module = superhtml,
109-
// .strip = true,
110-
// .filter = "if-else-loop",
125+
.filters = b.args orelse &.{},
111126
});
112127

113128
const run_unit_tests = b.addRunArtifact(unit_tests);

build.zig.zon

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
.hash = "tracy-0.0.0-4Xw-1pwwAABTfMgoDP1unCbZDZhJEfict7XCBGF6IdIn",
1414
},
1515
.lsp_kit = .{
16-
.url = "git+https://github.com/kristoff-it/lsp-kit?ref=zig-0.15#01c14e592d25dc57dfebba27b8bd2b4aa91c1140",
17-
.hash = "lsp_kit-0.1.0-bi_PL5YyCgA2QFEza6llr2Uy08QUQsWBu2wKvtr8tbLx",
16+
.url = "git+https://github.com/zigtools/lsp-kit#fe98e895ca3bd1b39965ab30f0f252f7b7e83ee6",
17+
.hash = "lsp_kit-0.1.0-bi_PLzAyCgClDh8_M0U9Q50ysdsQBuRuBTZfwg6rZPd6",
1818
},
1919
.scripty = .{
2020
.url = "git+https://github.com/kristoff-it/scripty#50dbab8945440089384f26ec165d870c29555247",

src/cli.zig

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,8 @@ pub fn panic(
3131
) noreturn {
3232
if (lsp_mode) {
3333
std.log.err("\n{s}\n\n{?f}", .{ msg, trace });
34-
} else {
35-
std.debug.print("\n{s}\n\n{?f}", .{ msg, trace });
3634
}
35+
3736
blk: {
3837
const out: std.fs.File = if (!lsp_mode) std.fs.File.stderr() else logging.log_file orelse break :blk;
3938
var writer = out.writerStreaming(&.{});
@@ -43,14 +42,7 @@ pub fn panic(
4342
w.print("Unable to dump stack trace: debug info stripped\n", .{}) catch {};
4443
break :blk;
4544
}
46-
const debug_info = std.debug.getSelfDebugInfo() catch |err| {
47-
w.print(
48-
"Unable to dump stack trace: Unable to open debug info: {s}\n",
49-
.{@errorName(err)},
50-
) catch {};
51-
break :blk;
52-
};
53-
std.debug.writeCurrentStackTrace(w, debug_info, .no_color, ret_addr) catch |err| {
45+
std.debug.writeCurrentStackTrace(.{ .first_address = ret_addr }, w, .no_color) catch |err| {
5446
w.print("Unable to dump stack trace: {t}\n", .{err}) catch {};
5547
break :blk;
5648
};

src/cli/check.zig

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,9 @@ fn checkFile(
107107
const arena = arena_impl.allocator();
108108

109109
const in_bytes = try base_dir.readFileAllocOptions(
110-
arena,
111110
sub_path,
112-
super.max_size,
113-
null,
111+
arena,
112+
.limited(super.max_size),
114113
.of(u8),
115114
0,
116115
);

src/cli/fmt.zig

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,9 @@ fn formatFile(
114114
const arena = arena_impl.allocator();
115115

116116
const in_bytes = try base_dir.readFileAllocOptions(
117-
arena,
118117
sub_path,
119-
super.max_size,
120-
null,
118+
arena,
119+
.limited(super.max_size),
121120
.of(u8),
122121
0,
123122
);

src/cli/interface.zig

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,9 @@ fn printInterfaceFromFile(
5454
const arena = arena_impl.allocator();
5555

5656
const in_bytes = try base_dir.readFileAllocOptions(
57-
arena,
5857
sub_path,
59-
1024 * 1024 * 4,
60-
null,
58+
arena,
59+
.limited(super.max_size),
6160
.of(u8),
6261
0,
6362
);

src/cli/logging.zig

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ pub fn logFn(
2222
comptime format: []const u8,
2323
args: anytype,
2424
) void {
25-
// switch (scope) {
26-
// .root, .super_lsp, .@"html/ast" => {},
27-
// else => return,
28-
// }
29-
inline for (build_options.enabled_scopes) |es| {
30-
if (comptime std.mem.eql(u8, es, @tagName(scope))) {
31-
break;
32-
}
33-
} else return;
25+
switch (scope) {
26+
.root, .super_lsp, .@"html/ast" => {},
27+
else => return,
28+
}
29+
// inline for (build_options.enabled_scopes) |es| {
30+
// if (comptime std.mem.eql(u8, es, @tagName(scope))) {
31+
// break;
32+
// }
33+
// } else return;
3434

3535
const l = log_file orelse return;
3636
const scope_prefix = "(" ++ @tagName(scope) ++ "): ";

0 commit comments

Comments
 (0)