| 1 | const std = @import("std"); |
| 2 | const common = @import("./_common.zig"); |
| 3 | |
| 4 | pub usingnamespace common.Main(struct { |
| 5 | pub const source_file = "Jamo"; |
| 6 | |
| 7 | pub const dest_file = "src/jamo.zig"; |
| 8 | |
| 9 | pub const dest_header = |
| 10 | \\pub const Jamo = struct { |
| 11 | \\ code: u21, |
| 12 | \\ short_name: []const u8, |
| 13 | \\}; |
| 14 | \\ |
| 15 | \\pub const data = [_]Jamo{ |
| 16 | \\ |
| 17 | ; |
| 18 | |
| 19 | pub const dest_footer = |
| 20 | \\}; |
| 21 | \\ |
| 22 | ; |
| 23 | |
| 24 | pub fn exec(alloc: std.mem.Allocator, line: []const u8, writer: anytype) !void { |
| 25 | _ = alloc; |
| 26 | var it = std.mem.tokenizeAny(u8, line, "; "); |
| 27 | |
| 28 | const first = it.next().?; |
| 29 | const short = it.next() orelse ""; |
| 30 | |
| 31 | try writer.print(" .{{ .code = 0x{s}, .short_name = \"{}\" }},\n", .{ first, std.zig.fmtEscapes(short) }); |
| 32 | } |
| 33 | }); |