authorgravatar for mail@linusgroh.deLinus Groh <mail@linusgroh.de> 2023-05-20 21:56:59+01:00
committergravatar for mail@linusgroh.deLinus Groh <mail@linusgroh.de> 2023-05-20 21:56:59+01:00
log3c1bdc9781eb25f8299a839bdfe7487231fa31dd
tree3f45b281fe834638295361651c64b609c558c7c0
parent83d419630c1a8e2e4891dbeabb500be423fb79ab

docgen: Rename Code.Id enum values to snake case


1 files changed, 22 insertions(+), 23 deletions(-)

doc/docgen.zig+22-23
......@@ -331,12 +331,12 @@ const Code = struct {
331331 additional_options: []const []const u8,
332332
333333 const Id = union(enum) {
334 Test,
335 TestError: []const u8,
336 TestSafety: []const u8,
337 Exe: ExpectedOutcome,
338 Obj: ?[]const u8,
339 Lib,
334 @"test",
335 test_error: []const u8,
336 test_safety: []const u8,
337 exe: ExpectedOutcome,
338 obj: ?[]const u8,
339 lib,
340340 };
341341};
342342
......@@ -563,25 +563,25 @@ fn genToc(allocator: Allocator, tokenizer: *Tokenizer) !Toc {
563563 var code_kind_id: Code.Id = undefined;
564564 var just_check_syntax = false;
565565 if (mem.eql(u8, code_kind_str, "exe")) {
566 code_kind_id = Code.Id{ .Exe = .succeed };
566 code_kind_id = Code.Id{ .exe = .succeed };
567567 } else if (mem.eql(u8, code_kind_str, "exe_err")) {
568 code_kind_id = Code.Id{ .Exe = .fail };
568 code_kind_id = Code.Id{ .exe = .fail };
569569 } else if (mem.eql(u8, code_kind_str, "exe_build_err")) {
570 code_kind_id = Code.Id{ .Exe = .build_fail };
570 code_kind_id = Code.Id{ .exe = .build_fail };
571571 } else if (mem.eql(u8, code_kind_str, "test")) {
572 code_kind_id = Code.Id.Test;
572 code_kind_id = .@"test";
573573 } else if (mem.eql(u8, code_kind_str, "test_err")) {
574 code_kind_id = Code.Id{ .TestError = error_str };
574 code_kind_id = Code.Id{ .test_error = error_str };
575575 } else if (mem.eql(u8, code_kind_str, "test_safety")) {
576 code_kind_id = Code.Id{ .TestSafety = error_str };
576 code_kind_id = Code.Id{ .test_safety = error_str };
577577 } else if (mem.eql(u8, code_kind_str, "obj")) {
578 code_kind_id = Code.Id{ .Obj = null };
578 code_kind_id = Code.Id{ .obj = null };
579579 } else if (mem.eql(u8, code_kind_str, "obj_err")) {
580 code_kind_id = Code.Id{ .Obj = error_str };
580 code_kind_id = Code.Id{ .obj = error_str };
581581 } else if (mem.eql(u8, code_kind_str, "lib")) {
582 code_kind_id = Code.Id.Lib;
582 code_kind_id = Code.Id.lib;
583583 } else if (mem.eql(u8, code_kind_str, "syntax")) {
584 code_kind_id = Code.Id{ .Obj = null };
584 code_kind_id = Code.Id{ .obj = null };
585585 just_check_syntax = true;
586586 } else {
587587 return parseError(tokenizer, code_kind_tok, "unrecognized code kind: {s}", .{code_kind_str});
......@@ -1371,7 +1371,7 @@ fn genHtml(
13711371 var shell_out = shell_buffer.writer();
13721372
13731373 switch (code.id) {
1374 Code.Id.Exe => |expected_outcome| code_block: {
1374 .exe => |expected_outcome| code_block: {
13751375 var build_args = std.ArrayList([]const u8).init(allocator);
13761376 defer build_args.deinit();
13771377 try build_args.appendSlice(&[_][]const u8{
......@@ -1513,7 +1513,7 @@ fn genHtml(
15131513 }
15141514 try shell_out.writeAll("\n");
15151515 },
1516 Code.Id.Test => {
1516 .@"test" => {
15171517 var test_args = std.ArrayList([]const u8).init(allocator);
15181518 defer test_args.deinit();
15191519
......@@ -1565,7 +1565,7 @@ fn genHtml(
15651565 const escaped_stdout = try escapeHtml(allocator, result.stdout);
15661566 try shell_out.print("\n{s}{s}\n", .{ escaped_stderr, escaped_stdout });
15671567 },
1568 Code.Id.TestError => |error_match| {
1568 .test_error => |error_match| {
15691569 var test_args = std.ArrayList([]const u8).init(allocator);
15701570 defer test_args.deinit();
15711571
......@@ -1621,8 +1621,7 @@ fn genHtml(
16211621 const colored_stderr = try termColor(allocator, escaped_stderr);
16221622 try shell_out.print("\n{s}\n", .{colored_stderr});
16231623 },
1624
1625 Code.Id.TestSafety => |error_match| {
1624 .test_safety => |error_match| {
16261625 var test_args = std.ArrayList([]const u8).init(allocator);
16271626 defer test_args.deinit();
16281627
......@@ -1685,7 +1684,7 @@ fn genHtml(
16851684 colored_stderr,
16861685 });
16871686 },
1688 Code.Id.Obj => |maybe_error_match| {
1687 .obj => |maybe_error_match| {
16891688 const name_plus_obj_ext = try std.fmt.allocPrint(allocator, "{s}{s}", .{ code.name, obj_ext });
16901689 var build_args = std.ArrayList([]const u8).init(allocator);
16911690 defer build_args.deinit();
......@@ -1758,7 +1757,7 @@ fn genHtml(
17581757 }
17591758 try shell_out.writeAll("\n");
17601759 },
1761 Code.Id.Lib => {
1760 .lib => {
17621761 const bin_basename = try std.zig.binNameAlloc(allocator, .{
17631762 .root_name = code.name,
17641763 .target = builtin.target,