From efca9d55662b8bcee7e804672a87fb768b9a922c Mon Sep 17 00:00:00 2001 From: Meghan Denny Date: Sat, 24 Dec 2022 15:54:50 -0800 Subject: [PATCH] use common.RangeEnum in more places --- scripts/LineBreak.zig | 18 +----------------- scripts/PropList.zig | 18 +----------------- scripts/Scripts.zig | 18 +----------------- scripts/VerticalOrientation.zig | 18 +----------------- 4 files changed, 4 insertions(+), 68 deletions(-) diff --git a/scripts/LineBreak.zig b/scripts/LineBreak.zig index 4572d4911e9c2e8b53952fca8f2744d2e656bef4..f81527cc977e21e4dae3bee5f5ff413ce346bdbb 100644 --- a/scripts/LineBreak.zig +++ b/scripts/LineBreak.zig @@ -28,21 +28,5 @@ pub usingnamespace common.Main(struct { \\ ; - pub fn exec(alloc: std.mem.Allocator, line: []const u8, writer: anytype) !bool { - _ = alloc; - var it = std.mem.tokenize(u8, line, "; "); - - const first = it.next().?; - const next = it.next().?; - - if (std.mem.indexOf(u8, first, "..")) |index| { - const start = first[0..index]; - const end = first[index + 2 ..]; - try writer.print(" .{{ .from = 0x{s}, .to = 0x{s}, .category = .{s} }},\n", .{ start, end, next }); - } else { - try writer.print(" .{{ .from = 0x{s}, .to = 0x{s}, .category = .{s} }},\n", .{ first, first, next }); - } - - return true; - } + pub usingnamespace common.RangeEnum("category"); }); diff --git a/scripts/PropList.zig b/scripts/PropList.zig index 2a002db29544a13ce05645585d4f6dd2ce6fa496..1541b8823dfee5be68e71388a4ccef99e102bd6d 100644 --- a/scripts/PropList.zig +++ b/scripts/PropList.zig @@ -57,21 +57,5 @@ pub usingnamespace common.Main(struct { \\ ; - pub fn exec(alloc: std.mem.Allocator, line: []const u8, writer: anytype) !bool { - _ = alloc; - var it = std.mem.tokenize(u8, line, "; "); - - const first = it.next().?; - const next = it.next().?; - - if (std.mem.indexOf(u8, first, "..")) |index| { - const start = first[0..index]; - const end = first[index + 2 ..]; - try writer.print(" .{{ .from = 0x{s}, .to = 0x{s}, .property = .{s} }},\n", .{ start, end, next }); - } else { - try writer.print(" .{{ .from = 0x{s}, .to = 0x{s}, .property = .{s} }},\n", .{ first, first, next }); - } - - return true; - } + pub usingnamespace common.RangeEnum("property"); }); diff --git a/scripts/Scripts.zig b/scripts/Scripts.zig index 31c5978a413ffdfea4c730b6cced8de044fe8243..55eb3389e176be53e0ab5a184391d2203a0cfac3 100644 --- a/scripts/Scripts.zig +++ b/scripts/Scripts.zig @@ -179,21 +179,5 @@ pub usingnamespace common.Main(struct { \\ ; - pub fn exec(alloc: std.mem.Allocator, line: []const u8, writer: anytype) !bool { - _ = alloc; - var it = std.mem.tokenize(u8, line, "; "); - - const first = it.next().?; - const next = it.next().?; - - if (std.mem.indexOf(u8, first, "..")) |index| { - const start = first[0..index]; - const end = first[index + 2 ..]; - try writer.print(" .{{ .from = 0x{s}, .to = 0x{s}, .script = .{s} }},\n", .{ start, end, next }); - } else { - try writer.print(" .{{ .from = 0x{s}, .to = 0x{s}, .script = .{s} }},\n", .{ first, first, next }); - } - - return true; - } + pub usingnamespace common.RangeEnum("script"); }); diff --git a/scripts/VerticalOrientation.zig b/scripts/VerticalOrientation.zig index 2cb8327fb5e59c5de54e4191ef861fda7fad2674..287027e2868d7319104ac8615e3bd3decccc0d1e 100644 --- a/scripts/VerticalOrientation.zig +++ b/scripts/VerticalOrientation.zig @@ -27,21 +27,5 @@ pub usingnamespace common.Main(struct { \\ ; - pub fn exec(alloc: std.mem.Allocator, line: []const u8, writer: anytype) !bool { - _ = alloc; - var it = std.mem.tokenize(u8, line, "; "); - - const first = it.next().?; - const next = it.next().?; - - if (std.mem.indexOf(u8, first, "..")) |index| { - const start = first[0..index]; - const end = first[index + 2 ..]; - try writer.print(" .{{ .from = 0x{s}, .to = 0x{s}, .orientation = .{s} }},\n", .{ start, end, next }); - } else { - try writer.print(" .{{ .from = 0x{s}, .to = 0x{s}, .orientation = .{s} }},\n", .{ first, first, next }); - } - - return true; - } + pub usingnamespace common.RangeEnum("orientation"); }); -- 2.54.0