| 1 | const std = @import("std"); |
| 2 | const common = @import("./_common.zig"); |
| 3 | |
| 4 | pub usingnamespace common.Main(struct { |
| 5 | pub const source_file = "PropertyAliases"; |
| 6 | |
| 7 | pub const dest_file = "src/property_aliases.zig"; |
| 8 | |
| 9 | pub const dest_header = |
| 10 | \\const std = @import("std"); |
| 11 | \\ |
| 12 | \\pub const data = [_][2][]const u8{ |
| 13 | \\ |
| 14 | ; |
| 15 | |
| 16 | pub const dest_footer = |
| 17 | \\}; |
| 18 | ; |
| 19 | |
| 20 | pub fn exec(alloc: std.mem.Allocator, line: []const u8, writer: anytype) !void { |
| 21 | _ = alloc; |
| 22 | const end = std.mem.indexOfScalar(u8, line, '#') orelse line.len; |
| 23 | var it = std.mem.tokenizeAny(u8, line[0..end], "; "); |
| 24 | |
| 25 | const short = it.next().?; |
| 26 | const long = it.next().?; |
| 27 | try writer.print(" .{{ \"{}\", \"{}\" }},\n", .{ |
| 28 | std.zig.fmtEscapes(short), |
| 29 | std.zig.fmtEscapes(long), |
| 30 | }); |
| 31 | while (it.next()) |more| { |
| 32 | try writer.print(" .{{ \"{}\", \"{}\" }},\n", .{ |
| 33 | std.zig.fmtEscapes(more), |
| 34 | std.zig.fmtEscapes(long), |
| 35 | }); |
| 36 | } |
| 37 | } |
| 38 | }); |