From a24bb6d70c6dfa105e2375da4b23421d1057295e Mon Sep 17 00:00:00 2001 From: Meghan Denny Date: Sat, 24 Dec 2022 20:20:15 -0800 Subject: [PATCH] scripts: no need for exec to return bool --- scripts/ArabicShaping.zig | 3 +-- scripts/BidiBrackets.zig | 3 +-- scripts/BidiMirroring.zig | 3 +-- scripts/Blocks.zig | 3 +-- scripts/CJKRadicals.zig | 3 +-- scripts/CaseFolding.zig | 3 +-- scripts/CompositionExclusions.zig | 3 +-- scripts/DerivedAge.zig | 4 +--- scripts/DerivedCoreProperties.zig | 4 +--- scripts/EastAsianWidth.zig | 4 +--- scripts/EmojiSources.zig | 6 ++---- scripts/EquivalentUnifiedIdeograph.zig | 4 +--- scripts/HangulSyllableType.zig | 4 +--- scripts/IndicPositionalCategory.zig | 4 +--- scripts/IndicSyllabicCategory.zig | 4 +--- scripts/Jamo.zig | 4 +--- scripts/NameAliases.zig | 4 +--- scripts/NamedSequences.zig | 4 +--- scripts/NamedSequencesProv.zig | 4 +--- scripts/PropertyAliases.zig | 4 +--- scripts/ScriptExtensions.zig | 4 +--- scripts/_common.zig | 8 ++------ 22 files changed, 24 insertions(+), 63 deletions(-) diff --git a/scripts/ArabicShaping.zig b/scripts/ArabicShaping.zig index 8f58aa5a9bafeb0b3f9059295e65d2012be07e25..a6418f3ccd28da2773aaa39bdfcf4615a9e828c5 100644 --- a/scripts/ArabicShaping.zig +++ b/scripts/ArabicShaping.zig @@ -139,7 +139,7 @@ pub usingnamespace common.Main(struct { \\ ; - pub fn exec(alloc: std.mem.Allocator, line: []const u8, writer: anytype) !bool { + pub fn exec(alloc: std.mem.Allocator, line: []const u8, writer: anytype) !void { var it = std.mem.split(u8, line, ";"); const c = std.mem.trim(u8, it.next().?, " "); const n = std.mem.trim(u8, it.next().?, " "); @@ -148,6 +148,5 @@ pub usingnamespace common.Main(struct { const g2 = try std.mem.replaceOwned(u8, alloc, g, " ", "_"); try writer.print(" .{{ .codepoint = 0x{s}, .schematic_name = \"{s}\", .joining_type = .{s}, .joining_group = .{s} }},\n", .{ c, n, t, g2 }); - return true; } }); diff --git a/scripts/BidiBrackets.zig b/scripts/BidiBrackets.zig index fc3ed3e24688cd66cb4fe4f1f0b8923862e21da1..5f2da7fccc634402c938f6264b67161ebe7f90fb 100644 --- a/scripts/BidiBrackets.zig +++ b/scripts/BidiBrackets.zig @@ -28,7 +28,7 @@ pub usingnamespace common.Main(struct { \\ ; - pub fn exec(alloc: std.mem.Allocator, line: []const u8, writer: anytype) !bool { + pub fn exec(alloc: std.mem.Allocator, line: []const u8, writer: anytype) !void { _ = alloc; var it = std.mem.split(u8, line, ";"); @@ -37,6 +37,5 @@ pub usingnamespace common.Main(struct { const c = std.mem.trim(u8, it.next().?, " "); try writer.print(" .{{ .codepoint = 0x{s}, .pair = 0x{s}, .type = .{s} }}, // {s}\n", .{ a, b, c[0..1], c[4..] }); - return true; } }); diff --git a/scripts/BidiMirroring.zig b/scripts/BidiMirroring.zig index 52ce42e95bec8db043235fd0cbda3a06553bd8f5..b1635309bc017c83fcd05992d1bcd2f484504d73 100644 --- a/scripts/BidiMirroring.zig +++ b/scripts/BidiMirroring.zig @@ -21,7 +21,7 @@ pub usingnamespace common.Main(struct { \\ ; - pub fn exec(alloc: std.mem.Allocator, line: []const u8, writer: anytype) !bool { + pub fn exec(alloc: std.mem.Allocator, line: []const u8, writer: anytype) !void { _ = alloc; var it = std.mem.tokenize(u8, line, "; #"); const c = it.next().?; @@ -29,6 +29,5 @@ pub usingnamespace common.Main(struct { const t = it.rest(); try writer.print(" .{{ .codepoint = 0x{s}, .mirror = 0x{s} }}, // {s}\n", .{ c, m, t }); - return true; } }); diff --git a/scripts/Blocks.zig b/scripts/Blocks.zig index cf505c90bcfacbb31c901320a65e1a0b64f3e52c..8f9afa68ee2a78b8556c6fc79164307d0139fa14 100644 --- a/scripts/Blocks.zig +++ b/scripts/Blocks.zig @@ -22,7 +22,7 @@ pub usingnamespace common.Main(struct { \\ ; - pub fn exec(alloc: std.mem.Allocator, line: []const u8, writer: anytype) !bool { + pub fn exec(alloc: std.mem.Allocator, line: []const u8, writer: anytype) !void { _ = alloc; var it1 = std.mem.split(u8, line, "; "); @@ -32,6 +32,5 @@ pub usingnamespace common.Main(struct { const name = it1.next().?; try writer.print(" .{{ .from = 0x{s}, .to = 0x{s}, .name = \"{s}\" }},\n", .{ from, to, name }); - return true; } }); diff --git a/scripts/CJKRadicals.zig b/scripts/CJKRadicals.zig index 7682d27fd4846c0959a8486db381af3f225558d7..eec229b33506136eb36bd0565dfac0002bf3b542 100644 --- a/scripts/CJKRadicals.zig +++ b/scripts/CJKRadicals.zig @@ -23,7 +23,7 @@ pub usingnamespace common.Main(struct { \\ ; - pub fn exec(alloc: std.mem.Allocator, line: []const u8, writer: anytype) !bool { + pub fn exec(alloc: std.mem.Allocator, line: []const u8, writer: anytype) !void { _ = alloc; var it = std.mem.tokenize(u8, line, "; "); var n = it.next().?; @@ -33,6 +33,5 @@ pub usingnamespace common.Main(struct { n = std.mem.trimRight(u8, n, "'"); try writer.print(" .{{ .number = {s}, .simplified = {}, .character = 0x{s}, .ideograph = 0x{s} }},\n", .{ n, s, c, i }); - return true; } }); diff --git a/scripts/CaseFolding.zig b/scripts/CaseFolding.zig index cf76c780e231566a82abf811d7d64fcaec2233a5..79002d9a8a34c3287962fe062cbdc1c302dbc56e 100644 --- a/scripts/CaseFolding.zig +++ b/scripts/CaseFolding.zig @@ -36,7 +36,7 @@ pub usingnamespace common.Main(struct { \\ ; - pub fn exec(alloc: std.mem.Allocator, line: []const u8, writer: anytype) !bool { + pub fn exec(alloc: std.mem.Allocator, line: []const u8, writer: anytype) !void { _ = alloc; var it = std.mem.split(u8, line, "; "); const code = it.next().?; @@ -61,6 +61,5 @@ pub usingnamespace common.Main(struct { try writer.writeAll(" } }, // "); try writer.writeAll(it.rest()); try writer.writeAll("\n"); - return true; } }); diff --git a/scripts/CompositionExclusions.zig b/scripts/CompositionExclusions.zig index 7e002ba126d44c8b653e1801206d58419f865163..4e8cfd35b59f2148d5f9e29e56b8e4e738ea2282 100644 --- a/scripts/CompositionExclusions.zig +++ b/scripts/CompositionExclusions.zig @@ -17,7 +17,7 @@ pub usingnamespace common.Main(struct { \\ ; - pub fn exec(alloc: std.mem.Allocator, line: []const u8, writer: anytype) !bool { + pub fn exec(alloc: std.mem.Allocator, line: []const u8, writer: anytype) !void { _ = alloc; var it = std.mem.split(u8, line, " "); try writer.print(" 0x{s}, // ", .{it.next().?}); @@ -30,6 +30,5 @@ pub usingnamespace common.Main(struct { break; } } - return true; } }); diff --git a/scripts/DerivedAge.zig b/scripts/DerivedAge.zig index b0af7593005316ba6bb6bd99cd9b1b83bfe6df65..95b59231d8c02a9d32cb93b9706f587ab6cb9e01 100644 --- a/scripts/DerivedAge.zig +++ b/scripts/DerivedAge.zig @@ -22,7 +22,7 @@ pub usingnamespace common.Main(struct { \\ ; - pub fn exec(alloc: std.mem.Allocator, line: []const u8, writer: anytype) !bool { + pub fn exec(alloc: std.mem.Allocator, line: []const u8, writer: anytype) !void { _ = alloc; var it = std.mem.tokenize(u8, line, "; "); @@ -41,7 +41,5 @@ pub usingnamespace common.Main(struct { const minor = jt.next().?; try writer.print(" .since = .{{ {s},{s} }} }},\n", .{ major, minor }); } - - return true; } }); diff --git a/scripts/DerivedCoreProperties.zig b/scripts/DerivedCoreProperties.zig index 41b77811a3ba5f483d77427af8d8e7cfdce7c352..850fd05a43dc577980cea1aabb4a358092b0496d 100644 --- a/scripts/DerivedCoreProperties.zig +++ b/scripts/DerivedCoreProperties.zig @@ -42,7 +42,7 @@ pub usingnamespace common.Main(struct { \\ ; - pub fn exec(alloc: std.mem.Allocator, line: []const u8, writer: anytype) !bool { + pub fn exec(alloc: std.mem.Allocator, line: []const u8, writer: anytype) !void { _ = alloc; var it = std.mem.tokenize(u8, line, "; "); @@ -58,7 +58,5 @@ pub usingnamespace common.Main(struct { const prop = it.next().?; try writer.print(" .prop = .{s} }},\n", .{prop}); } - - return true; } }); diff --git a/scripts/EastAsianWidth.zig b/scripts/EastAsianWidth.zig index d5caf1a0ab6ef0c9eeedb458c2444bb4b0b7599c..4c1b50f8f1fe5375196fe01307a7fc797d470ebd 100644 --- a/scripts/EastAsianWidth.zig +++ b/scripts/EastAsianWidth.zig @@ -22,7 +22,7 @@ pub usingnamespace common.Main(struct { \\ ; - pub fn exec(alloc: std.mem.Allocator, line: []const u8, writer: anytype) !bool { + pub fn exec(alloc: std.mem.Allocator, line: []const u8, writer: anytype) !void { _ = alloc; var it = std.mem.tokenize(u8, line, "; "); @@ -38,7 +38,5 @@ pub usingnamespace common.Main(struct { const prop = it.next().?; try writer.print(" .prop = .{s} }},\n", .{prop}); } - - return true; } }); diff --git a/scripts/EmojiSources.zig b/scripts/EmojiSources.zig index c572f35c9bf6142cacd5a43fdcb9f35757c9b8b9..9715985ef1a3b52899beba67214390189b0e1a1c 100644 --- a/scripts/EmojiSources.zig +++ b/scripts/EmojiSources.zig @@ -23,9 +23,9 @@ pub usingnamespace common.Main(struct { \\ ; - pub fn exec(alloc: std.mem.Allocator, line: []const u8, writer: anytype) !bool { + pub fn exec(alloc: std.mem.Allocator, line: []const u8, writer: anytype) !void { _ = alloc; - if (std.mem.count(u8, line, " ") > 0) return true; + if (std.mem.count(u8, line, " ") > 0) return; var it = std.mem.split(u8, line, ";"); const code = it.next().?; // FIXME remove @as and temp vars after switch off stage1 @@ -39,7 +39,5 @@ pub usingnamespace common.Main(struct { kddi, softbank, }); - - return true; } }); diff --git a/scripts/EquivalentUnifiedIdeograph.zig b/scripts/EquivalentUnifiedIdeograph.zig index 5171f355695570f3394b7c91114cc0ce35d2f7c5..44e503db3ebcd09dcde0b45ef5f3e1797423d60b 100644 --- a/scripts/EquivalentUnifiedIdeograph.zig +++ b/scripts/EquivalentUnifiedIdeograph.zig @@ -16,7 +16,7 @@ pub usingnamespace common.Main(struct { \\ ; - pub fn exec(alloc: std.mem.Allocator, line: []const u8, writer: anytype) !bool { + pub fn exec(alloc: std.mem.Allocator, line: []const u8, writer: anytype) !void { _ = alloc; var it = std.mem.tokenize(u8, line, "; "); @@ -33,7 +33,5 @@ pub usingnamespace common.Main(struct { } else { try writer.print(" .{{ 0x{s}, 0x{s} }},\n", .{ first, next }); } - - return true; } }); diff --git a/scripts/HangulSyllableType.zig b/scripts/HangulSyllableType.zig index 32c34473df0f060221dc26cdb428b26188318448..7c480c23ce4a1540d84e67c7ae17a8fe38a291a4 100644 --- a/scripts/HangulSyllableType.zig +++ b/scripts/HangulSyllableType.zig @@ -22,7 +22,7 @@ pub usingnamespace common.Main(struct { \\ ; - pub fn exec(alloc: std.mem.Allocator, line: []const u8, writer: anytype) !bool { + pub fn exec(alloc: std.mem.Allocator, line: []const u8, writer: anytype) !void { _ = alloc; var it = std.mem.tokenize(u8, line, "; "); @@ -38,7 +38,5 @@ pub usingnamespace common.Main(struct { const prop = it.next().?; try writer.print(" .prop = .{s} }},\n", .{prop}); } - - return true; } }); diff --git a/scripts/IndicPositionalCategory.zig b/scripts/IndicPositionalCategory.zig index 8ccdd813831565df10f361389114e9e25ac65d29..e981f80e242b72b7e1e1696658e00a0dcd9345eb 100644 --- a/scripts/IndicPositionalCategory.zig +++ b/scripts/IndicPositionalCategory.zig @@ -37,7 +37,7 @@ pub usingnamespace common.Main(struct { \\ ; - pub fn exec(alloc: std.mem.Allocator, line: []const u8, writer: anytype) !bool { + pub fn exec(alloc: std.mem.Allocator, line: []const u8, writer: anytype) !void { _ = alloc; var it = std.mem.tokenize(u8, line, "; "); @@ -54,7 +54,5 @@ pub usingnamespace common.Main(struct { } else { try writer.print(" .{{ .code = 0x{s}, .category = .{s} }},\n", .{ first, next }); } - - return true; } }); diff --git a/scripts/IndicSyllabicCategory.zig b/scripts/IndicSyllabicCategory.zig index cdba3df272624b4bcbe2955a4ba7b285a472db71..6d505cf7ac81b60bd36e5afd967e418fbd995476 100644 --- a/scripts/IndicSyllabicCategory.zig +++ b/scripts/IndicSyllabicCategory.zig @@ -57,7 +57,7 @@ pub usingnamespace common.Main(struct { \\ ; - pub fn exec(alloc: std.mem.Allocator, line: []const u8, writer: anytype) !bool { + pub fn exec(alloc: std.mem.Allocator, line: []const u8, writer: anytype) !void { _ = alloc; var it = std.mem.tokenize(u8, line, "; "); @@ -74,7 +74,5 @@ pub usingnamespace common.Main(struct { } else { try writer.print(" .{{ .code = 0x{s}, .category = .{s} }},\n", .{ first, next }); } - - return true; } }); diff --git a/scripts/Jamo.zig b/scripts/Jamo.zig index 2d14d890d43ff6eb9b347d642e8358dfd180e2c3..9bf8de7906169178db5e1e72fc9a5d7cc2380462 100644 --- a/scripts/Jamo.zig +++ b/scripts/Jamo.zig @@ -21,7 +21,7 @@ pub usingnamespace common.Main(struct { \\ ; - pub fn exec(alloc: std.mem.Allocator, line: []const u8, writer: anytype) !bool { + pub fn exec(alloc: std.mem.Allocator, line: []const u8, writer: anytype) !void { _ = alloc; var it = std.mem.tokenize(u8, line, "; "); @@ -30,7 +30,5 @@ pub usingnamespace common.Main(struct { const actual = if (std.mem.eql(u8, next, "#")) "" else next; try writer.print(" .{{ .code = 0x{s}, .short_name = \"{}\" }},\n", .{ first, std.zig.fmtEscapes(actual) }); - - return true; } }); diff --git a/scripts/NameAliases.zig b/scripts/NameAliases.zig index aaacce3d50ddecd9f0980691ad8b63b873e46384..96bb2c539be55141cdeaa148c166e774042c7bbf 100644 --- a/scripts/NameAliases.zig +++ b/scripts/NameAliases.zig @@ -28,7 +28,7 @@ pub usingnamespace common.Main(struct { \\ ; - pub fn exec(alloc: std.mem.Allocator, line: []const u8, writer: anytype) !bool { + pub fn exec(alloc: std.mem.Allocator, line: []const u8, writer: anytype) !void { _ = alloc; var it = std.mem.split(u8, line, ";"); @@ -37,7 +37,5 @@ pub usingnamespace common.Main(struct { std.zig.fmtEscapes(it.next().?), it.next().?, }); - - return true; } }); diff --git a/scripts/NamedSequences.zig b/scripts/NamedSequences.zig index e080e4b76909dbb1ea9d7e42383d171ee0c78cd4..8840719d4bd1312896826f4a0b56e6c406d323a4 100644 --- a/scripts/NamedSequences.zig +++ b/scripts/NamedSequences.zig @@ -21,7 +21,7 @@ pub usingnamespace common.Main(struct { \\ ; - pub fn exec(alloc: std.mem.Allocator, line: []const u8, writer: anytype) !bool { + pub fn exec(alloc: std.mem.Allocator, line: []const u8, writer: anytype) !void { _ = alloc; var it = std.mem.split(u8, line, ";"); @@ -32,7 +32,5 @@ pub usingnamespace common.Main(struct { try writer.print(" 0x{s},", .{jtem}); } try writer.writeAll(" } },\n"); - - return true; } }); diff --git a/scripts/NamedSequencesProv.zig b/scripts/NamedSequencesProv.zig index 5e3249ff1bbd16bb3dc345141d0ba65c57ee4176..873c2967376d29d15f0b0e1939a63d4ee75d5099 100644 --- a/scripts/NamedSequencesProv.zig +++ b/scripts/NamedSequencesProv.zig @@ -21,7 +21,7 @@ pub usingnamespace common.Main(struct { \\ ; - pub fn exec(alloc: std.mem.Allocator, line: []const u8, writer: anytype) !bool { + pub fn exec(alloc: std.mem.Allocator, line: []const u8, writer: anytype) !void { _ = alloc; var it = std.mem.split(u8, line, ";"); @@ -32,7 +32,5 @@ pub usingnamespace common.Main(struct { try writer.print(" 0x{s},", .{jtem}); } try writer.writeAll(" } },\n"); - - return true; } }); diff --git a/scripts/PropertyAliases.zig b/scripts/PropertyAliases.zig index 0c48c59049f761388bdcd5d6eb6cc28281ff2c90..ce1cb7d252362328a42ef12b027c94a44eb884dc 100644 --- a/scripts/PropertyAliases.zig +++ b/scripts/PropertyAliases.zig @@ -21,7 +21,7 @@ pub usingnamespace common.Main(struct { \\}; ; - pub fn exec(alloc: std.mem.Allocator, line: []const u8, writer: anytype) !bool { + pub fn exec(alloc: std.mem.Allocator, line: []const u8, writer: anytype) !void { _ = alloc; var it = std.mem.tokenize(u8, line, "; "); @@ -29,7 +29,5 @@ pub usingnamespace common.Main(struct { std.zig.fmtEscapes(it.next().?), std.zig.fmtEscapes(it.next().?), }); - - return true; } }); diff --git a/scripts/ScriptExtensions.zig b/scripts/ScriptExtensions.zig index 9aa87acb1cb3b4c75b2e6bf85af8917db5092b08..41d35952d20497eca36df5a1ae6468a231c6bc0f 100644 --- a/scripts/ScriptExtensions.zig +++ b/scripts/ScriptExtensions.zig @@ -87,7 +87,7 @@ pub usingnamespace common.Main(struct { \\ ; - pub fn exec(alloc: std.mem.Allocator, line: []const u8, writer: anytype) !bool { + pub fn exec(alloc: std.mem.Allocator, line: []const u8, writer: anytype) !void { _ = alloc; var it = std.mem.tokenize(u8, line, "; "); @@ -103,8 +103,6 @@ pub usingnamespace common.Main(struct { } else { try writer.print(" .{{ .code = 0x{s}, .scripts = {} }},\n", .{ first, fmtScripts(untilComment(it.rest())) }); } - - return true; } }); diff --git a/scripts/_common.zig b/scripts/_common.zig index d5f250d313cda88b8bd3f330da7d782229bfb0ce..405f5b3990a68bc0df34a463c797dc08fccdb2b1 100644 --- a/scripts/_common.zig +++ b/scripts/_common.zig @@ -64,9 +64,7 @@ pub fn Main(comptime T: type) type { continue; } - if (!(try T.exec(arena.allocator(), line, w))) { - break; - } + try T.exec(arena.allocator(), line, w); std.debug.print("{s}", .{ansi.csi.CursorUp(1)}); std.debug.print("{s}", .{ansi.csi.EraseInLine(0)}); @@ -85,7 +83,7 @@ pub fn nullify(input: []const u8) ?[]const u8 { pub fn RangeEnum(comptime prop: []const u8) type { return struct { - pub fn exec(alloc: std.mem.Allocator, line: []const u8, writer: anytype) !bool { + pub fn exec(alloc: std.mem.Allocator, line: []const u8, writer: anytype) !void { _ = alloc; var it = std.mem.tokenize(u8, line, "; "); @@ -99,8 +97,6 @@ pub fn RangeEnum(comptime prop: []const u8) type { } else { try writer.print(" .{{ .from = 0x{s}, .to = 0x{s}, .{s} = .{s} }},\n", .{ first, first, prop, next }); } - - return true; } }; } -- 2.54.0