| 1 | const std = @import("std"); |
| 2 | const common = @import("./_common.zig"); |
| 3 | |
| 4 | pub usingnamespace common.Main(struct { |
| 5 | pub const source_file = "HangulSyllableType"; |
| 6 | |
| 7 | pub const dest_file = "src/hangul_syllable_type.zig"; |
| 8 | |
| 9 | pub const dest_header = |
| 10 | \\const ucd = @import("./lib.zig"); |
| 11 | \\ |
| 12 | \\pub const HangulSyllableType = struct { |
| 13 | \\ from: u21, |
| 14 | \\ to: u21, |
| 15 | \\ prop: ucd.HangulSyllableType, |
| 16 | \\}; |
| 17 | \\ |
| 18 | \\pub const data = [_]HangulSyllableType{ |
| 19 | \\ |
| 20 | ; |
| 21 | |
| 22 | pub const dest_footer = |
| 23 | \\}; |
| 24 | \\ |
| 25 | ; |
| 26 | |
| 27 | pub fn exec(alloc: std.mem.Allocator, line: []const u8, writer: anytype) !void { |
| 28 | _ = alloc; |
| 29 | var it = std.mem.tokenizeAny(u8, line, "; "); |
| 30 | |
| 31 | { |
| 32 | const range = it.next().?; |
| 33 | if (std.mem.indexOf(u8, range, "..")) |index| { |
| 34 | try writer.print(" .{{ .from = 0x{s}, .to = 0x{s},", .{ range[0..index], range[index + 2 ..] }); |
| 35 | } else { |
| 36 | try writer.print(" .{{ .from = 0x{s}, .to = 0x{s},", .{ range, range }); |
| 37 | } |
| 38 | } |
| 39 | { |
| 40 | const prop = it.next().?; |
| 41 | try writer.print(" .prop = .{s} }},\n", .{prop}); |
| 42 | } |
| 43 | } |
| 44 | }); |