1const std = @import("std");
2const common = @import("./_common.zig");
3
4pub usingnamespace common.Main(struct {
5 pub const source_file = "BidiBrackets";
6
7 pub const dest_file = "src/bidi_brackets.zig";
8
9 pub const dest_header =
10 \\pub const BracketPairing = struct {
11 \\ codepoint: u21,
12 \\ pair: u21,
13 \\ type: Type,
14 \\
15 \\ pub const Type = enum {
16 \\ o,
17 \\ c,
18 \\ n,
19 \\ };
20 \\};
21 \\
22 \\pub const data = [_]BracketPairing{
23 \\
24 ;
25
26 pub const dest_footer =
27 \\};
28 \\
29 ;
30
31 pub fn exec(alloc: std.mem.Allocator, line: []const u8, writer: anytype) !void {
32 _ = alloc;
33
34 var it = std.mem.splitScalar(u8, line, ';');
35 const a = std.mem.trim(u8, it.next().?, " ");
36 const b = std.mem.trim(u8, it.next().?, " ");
37 const c = std.mem.trim(u8, it.next().?, " ");
38
39 try writer.print(" .{{ .codepoint = 0x{s}, .pair = 0x{s}, .type = .{s} }},\n", .{ a, b, c[0..1] });
40 }
41});