authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2022-12-24 15:54:50 -08:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2022-12-24 15:54:50 -08:00
logefca9d55662b8bcee7e804672a87fb768b9a922c
treef8012271ed994f1118f38548def7e6192e690530
parent8dc7a951c26c92720893cb4903d0fa616bcc79ea

use common.RangeEnum in more places


4 files changed, 4 insertions(+), 68 deletions(-)

scripts/LineBreak.zig+1-17
...@@ -28,21 +28,5 @@ pub usingnamespace common.Main(struct {...@@ -28,21 +28,5 @@ pub usingnamespace common.Main(struct {
28 \\28 \\
29 ;29 ;
3030
31 pub fn exec(alloc: std.mem.Allocator, line: []const u8, writer: anytype) !bool {31 pub usingnamespace common.RangeEnum("category");
32 _ = alloc;
33 var it = std.mem.tokenize(u8, line, "; ");
34
35 const first = it.next().?;
36 const next = it.next().?;
37
38 if (std.mem.indexOf(u8, first, "..")) |index| {
39 const start = first[0..index];
40 const end = first[index + 2 ..];
41 try writer.print(" .{{ .from = 0x{s}, .to = 0x{s}, .category = .{s} }},\n", .{ start, end, next });
42 } else {
43 try writer.print(" .{{ .from = 0x{s}, .to = 0x{s}, .category = .{s} }},\n", .{ first, first, next });
44 }
45
46 return true;
47 }
48});32});
scripts/PropList.zig+1-17
...@@ -57,21 +57,5 @@ pub usingnamespace common.Main(struct {...@@ -57,21 +57,5 @@ pub usingnamespace common.Main(struct {
57 \\57 \\
58 ;58 ;
5959
60 pub fn exec(alloc: std.mem.Allocator, line: []const u8, writer: anytype) !bool {60 pub usingnamespace common.RangeEnum("property");
61 _ = alloc;
62 var it = std.mem.tokenize(u8, line, "; ");
63
64 const first = it.next().?;
65 const next = it.next().?;
66
67 if (std.mem.indexOf(u8, first, "..")) |index| {
68 const start = first[0..index];
69 const end = first[index + 2 ..];
70 try writer.print(" .{{ .from = 0x{s}, .to = 0x{s}, .property = .{s} }},\n", .{ start, end, next });
71 } else {
72 try writer.print(" .{{ .from = 0x{s}, .to = 0x{s}, .property = .{s} }},\n", .{ first, first, next });
73 }
74
75 return true;
76 }
77});61});
scripts/Scripts.zig+1-17
...@@ -179,21 +179,5 @@ pub usingnamespace common.Main(struct {...@@ -179,21 +179,5 @@ pub usingnamespace common.Main(struct {
179 \\179 \\
180 ;180 ;
181181
182 pub fn exec(alloc: std.mem.Allocator, line: []const u8, writer: anytype) !bool {182 pub usingnamespace common.RangeEnum("script");
183 _ = alloc;
184 var it = std.mem.tokenize(u8, line, "; ");
185
186 const first = it.next().?;
187 const next = it.next().?;
188
189 if (std.mem.indexOf(u8, first, "..")) |index| {
190 const start = first[0..index];
191 const end = first[index + 2 ..];
192 try writer.print(" .{{ .from = 0x{s}, .to = 0x{s}, .script = .{s} }},\n", .{ start, end, next });
193 } else {
194 try writer.print(" .{{ .from = 0x{s}, .to = 0x{s}, .script = .{s} }},\n", .{ first, first, next });
195 }
196
197 return true;
198 }
199});183});
scripts/VerticalOrientation.zig+1-17
...@@ -27,21 +27,5 @@ pub usingnamespace common.Main(struct {...@@ -27,21 +27,5 @@ pub usingnamespace common.Main(struct {
27 \\27 \\
28 ;28 ;
2929
30 pub fn exec(alloc: std.mem.Allocator, line: []const u8, writer: anytype) !bool {30 pub usingnamespace common.RangeEnum("orientation");
31 _ = alloc;
32 var it = std.mem.tokenize(u8, line, "; ");
33
34 const first = it.next().?;
35 const next = it.next().?;
36
37 if (std.mem.indexOf(u8, first, "..")) |index| {
38 const start = first[0..index];
39 const end = first[index + 2 ..];
40 try writer.print(" .{{ .from = 0x{s}, .to = 0x{s}, .orientation = .{s} }},\n", .{ start, end, next });
41 } else {
42 try writer.print(" .{{ .from = 0x{s}, .to = 0x{s}, .orientation = .{s} }},\n", .{ first, first, next });
43 }
44
45 return true;
46 }
47});31});