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 {...@@ -331,12 +331,12 @@ const Code = struct {
331 additional_options: []const []const u8,331 additional_options: []const []const u8,
332332
333 const Id = union(enum) {333 const Id = union(enum) {
334 Test,334 @"test",
335 TestError: []const u8,335 test_error: []const u8,
336 TestSafety: []const u8,336 test_safety: []const u8,
337 Exe: ExpectedOutcome,337 exe: ExpectedOutcome,
338 Obj: ?[]const u8,338 obj: ?[]const u8,
339 Lib,339 lib,
340 };340 };
341};341};
342342
...@@ -563,25 +563,25 @@ fn genToc(allocator: Allocator, tokenizer: *Tokenizer) !Toc {...@@ -563,25 +563,25 @@ fn genToc(allocator: Allocator, tokenizer: *Tokenizer) !Toc {
563 var code_kind_id: Code.Id = undefined;563 var code_kind_id: Code.Id = undefined;
564 var just_check_syntax = false;564 var just_check_syntax = false;
565 if (mem.eql(u8, code_kind_str, "exe")) {565 if (mem.eql(u8, code_kind_str, "exe")) {
566 code_kind_id = Code.Id{ .Exe = .succeed };566 code_kind_id = Code.Id{ .exe = .succeed };
567 } else if (mem.eql(u8, code_kind_str, "exe_err")) {567 } 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 };
569 } else if (mem.eql(u8, code_kind_str, "exe_build_err")) {569 } 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 };
571 } else if (mem.eql(u8, code_kind_str, "test")) {571 } else if (mem.eql(u8, code_kind_str, "test")) {
572 code_kind_id = Code.Id.Test;572 code_kind_id = .@"test";
573 } else if (mem.eql(u8, code_kind_str, "test_err")) {573 } 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 };
575 } else if (mem.eql(u8, code_kind_str, "test_safety")) {575 } 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 };
577 } else if (mem.eql(u8, code_kind_str, "obj")) {577 } 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 };
579 } else if (mem.eql(u8, code_kind_str, "obj_err")) {579 } 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 };
581 } else if (mem.eql(u8, code_kind_str, "lib")) {581 } else if (mem.eql(u8, code_kind_str, "lib")) {
582 code_kind_id = Code.Id.Lib;582 code_kind_id = Code.Id.lib;
583 } else if (mem.eql(u8, code_kind_str, "syntax")) {583 } 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 };
585 just_check_syntax = true;585 just_check_syntax = true;
586 } else {586 } else {
587 return parseError(tokenizer, code_kind_tok, "unrecognized code kind: {s}", .{code_kind_str});587 return parseError(tokenizer, code_kind_tok, "unrecognized code kind: {s}", .{code_kind_str});
...@@ -1371,7 +1371,7 @@ fn genHtml(...@@ -1371,7 +1371,7 @@ fn genHtml(
1371 var shell_out = shell_buffer.writer();1371 var shell_out = shell_buffer.writer();
13721372
1373 switch (code.id) {1373 switch (code.id) {
1374 Code.Id.Exe => |expected_outcome| code_block: {1374 .exe => |expected_outcome| code_block: {
1375 var build_args = std.ArrayList([]const u8).init(allocator);1375 var build_args = std.ArrayList([]const u8).init(allocator);
1376 defer build_args.deinit();1376 defer build_args.deinit();
1377 try build_args.appendSlice(&[_][]const u8{1377 try build_args.appendSlice(&[_][]const u8{
...@@ -1513,7 +1513,7 @@ fn genHtml(...@@ -1513,7 +1513,7 @@ fn genHtml(
1513 }1513 }
1514 try shell_out.writeAll("\n");1514 try shell_out.writeAll("\n");
1515 },1515 },
1516 Code.Id.Test => {1516 .@"test" => {
1517 var test_args = std.ArrayList([]const u8).init(allocator);1517 var test_args = std.ArrayList([]const u8).init(allocator);
1518 defer test_args.deinit();1518 defer test_args.deinit();
15191519
...@@ -1565,7 +1565,7 @@ fn genHtml(...@@ -1565,7 +1565,7 @@ fn genHtml(
1565 const escaped_stdout = try escapeHtml(allocator, result.stdout);1565 const escaped_stdout = try escapeHtml(allocator, result.stdout);
1566 try shell_out.print("\n{s}{s}\n", .{ escaped_stderr, escaped_stdout });1566 try shell_out.print("\n{s}{s}\n", .{ escaped_stderr, escaped_stdout });
1567 },1567 },
1568 Code.Id.TestError => |error_match| {1568 .test_error => |error_match| {
1569 var test_args = std.ArrayList([]const u8).init(allocator);1569 var test_args = std.ArrayList([]const u8).init(allocator);
1570 defer test_args.deinit();1570 defer test_args.deinit();
15711571
...@@ -1621,8 +1621,7 @@ fn genHtml(...@@ -1621,8 +1621,7 @@ fn genHtml(
1621 const colored_stderr = try termColor(allocator, escaped_stderr);1621 const colored_stderr = try termColor(allocator, escaped_stderr);
1622 try shell_out.print("\n{s}\n", .{colored_stderr});1622 try shell_out.print("\n{s}\n", .{colored_stderr});
1623 },1623 },
16241624 .test_safety => |error_match| {
1625 Code.Id.TestSafety => |error_match| {
1626 var test_args = std.ArrayList([]const u8).init(allocator);1625 var test_args = std.ArrayList([]const u8).init(allocator);
1627 defer test_args.deinit();1626 defer test_args.deinit();
16281627
...@@ -1685,7 +1684,7 @@ fn genHtml(...@@ -1685,7 +1684,7 @@ fn genHtml(
1685 colored_stderr,1684 colored_stderr,
1686 });1685 });
1687 },1686 },
1688 Code.Id.Obj => |maybe_error_match| {1687 .obj => |maybe_error_match| {
1689 const name_plus_obj_ext = try std.fmt.allocPrint(allocator, "{s}{s}", .{ code.name, obj_ext });1688 const name_plus_obj_ext = try std.fmt.allocPrint(allocator, "{s}{s}", .{ code.name, obj_ext });
1690 var build_args = std.ArrayList([]const u8).init(allocator);1689 var build_args = std.ArrayList([]const u8).init(allocator);
1691 defer build_args.deinit();1690 defer build_args.deinit();
...@@ -1758,7 +1757,7 @@ fn genHtml(...@@ -1758,7 +1757,7 @@ fn genHtml(
1758 }1757 }
1759 try shell_out.writeAll("\n");1758 try shell_out.writeAll("\n");
1760 },1759 },
1761 Code.Id.Lib => {1760 .lib => {
1762 const bin_basename = try std.zig.binNameAlloc(allocator, .{1761 const bin_basename = try std.zig.binNameAlloc(allocator, .{
1763 .root_name = code.name,1762 .root_name = code.name,
1764 .target = builtin.target,1763 .target = builtin.target,