| author | |
| committer | |
| log | f696490ad2f8d23745f849d6c74e1fa642864288 |
| tree | 0fd2c5aa250758ee2c5d5cdf06781288379b4147 |
| parent | cb30c51eb16ee21af7ac89aef8443603a7e55216 |
5 files changed, 74 insertions(+), 0 deletions(-)
generate.zig+1| ... | ... | @@ -20,6 +20,7 @@ const files = [_]type{ |
| 20 | 20 | @import("./scripts/LineBreak.zig"), |
| 21 | 21 | @import("./scripts/NameAliases.zig"), |
| 22 | 22 | @import("./scripts/NamedSequences.zig"), |
| 23 | @import("./scripts/NamedSequencesProv.zig"), | |
| 23 | 24 | }; |
| 24 | 25 | |
| 25 | 26 | pub fn main() !void { |
scripts/NamedSequencesProv.zig created+38| ... | ... | @@ -0,0 +1,38 @@ |
| 1 | const std = @import("std"); | |
| 2 | const common = @import("./_common.zig"); | |
| 3 | ||
| 4 | pub usingnamespace common.Main(struct { | |
| 5 | pub const source_file = "NamedSequencesProv"; | |
| 6 | ||
| 7 | pub const dest_file = "src/named_sequences_prov.zig"; | |
| 8 | ||
| 9 | pub const dest_header = | |
| 10 | \\pub const NamedSequence = struct { | |
| 11 | \\ name: []const u8, | |
| 12 | \\ sequence: []const u21, | |
| 13 | \\}; | |
| 14 | \\ | |
| 15 | \\pub const data = [_]NamedSequence{ | |
| 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) !bool { | |
| 25 | _ = alloc; | |
| 26 | var it = std.mem.split(u8, line, ";"); | |
| 27 | ||
| 28 | try writer.print(" .{{ .name = \"{}\", .sequence = &[_]u21{{", .{std.zig.fmtEscapes(it.next().?)}); | |
| 29 | ||
| 30 | var jt = std.mem.tokenize(u8, it.next().?, " "); | |
| 31 | while (jt.next()) |jtem| { | |
| 32 | try writer.print(" 0x{s},", .{jtem}); | |
| 33 | } | |
| 34 | try writer.writeAll(" } },\n"); | |
| 35 | ||
| 36 | return true; | |
| 37 | } | |
| 38 | }); |
src/lib.zig+1| ... | ... | @@ -21,3 +21,4 @@ pub const jamo = @import("./jamo.zig"); |
| 21 | 21 | pub const line_break = @import("./line_break.zig"); |
| 22 | 22 | pub const name_aliases = @import("./name_aliases.zig"); |
| 23 | 23 | pub const named_sequences = @import("./named_sequences.zig"); |
| 24 | pub const named_sequences_prov = @import("./named_sequences_prov.zig"); |
src/main.zig+1| ... | ... | @@ -25,6 +25,7 @@ pub fn main() !void { |
| 25 | 25 | ucd.line_break, |
| 26 | 26 | ucd.name_aliases, |
| 27 | 27 | ucd.named_sequences, |
| 28 | ucd.named_sequences_prov, | |
| 28 | 29 | }; |
| 29 | 30 | |
| 30 | 31 | inline for (data) |b| { |
src/named_sequences_prov.zig created+33| ... | ... | @@ -0,0 +1,33 @@ |
| 1 | // This file is part of the Unicode Character Database | |
| 2 | // For documentation, see http://www.unicode.org/reports/tr44/ | |
| 3 | // | |
| 4 | // Based on the source file: https://unicode.org/Public/13.0.0/ucd/NamedSequencesProv.txt | |
| 5 | // | |
| 6 | // zig fmt: off | |
| 7 | ||
| 8 | pub const NamedSequence = struct { | |
| 9 | name: []const u8, | |
| 10 | sequence: []const u21, | |
| 11 | }; | |
| 12 | ||
| 13 | pub const data = [_]NamedSequence{ | |
| 14 | .{ .name = "DEVANAGARI SEQUENCE FOR LETTER QA", .sequence = &[_]u21{ 0x0915, 0x093C, } }, | |
| 15 | .{ .name = "DEVANAGARI SEQUENCE FOR LETTER KHHA", .sequence = &[_]u21{ 0x0916, 0x093C, } }, | |
| 16 | .{ .name = "DEVANAGARI SEQUENCE FOR LETTER GHHA", .sequence = &[_]u21{ 0x0917, 0x093C, } }, | |
| 17 | .{ .name = "DEVANAGARI SEQUENCE FOR LETTER ZA", .sequence = &[_]u21{ 0x091C, 0x093C, } }, | |
| 18 | .{ .name = "DEVANAGARI SEQUENCE FOR LETTER DDDHA", .sequence = &[_]u21{ 0x0921, 0x093C, } }, | |
| 19 | .{ .name = "DEVANAGARI SEQUENCE FOR LETTER RHA", .sequence = &[_]u21{ 0x0922, 0x093C, } }, | |
| 20 | .{ .name = "DEVANAGARI SEQUENCE FOR LETTER FA", .sequence = &[_]u21{ 0x092B, 0x093C, } }, | |
| 21 | .{ .name = "DEVANAGARI SEQUENCE FOR LETTER YYA", .sequence = &[_]u21{ 0x092F, 0x093C, } }, | |
| 22 | .{ .name = "BENGALI SEQUENCE FOR LETTER RRA", .sequence = &[_]u21{ 0x09A1, 0x09BC, } }, | |
| 23 | .{ .name = "BENGALI SEQUENCE FOR LETTER RHA", .sequence = &[_]u21{ 0x09A2, 0x09BC, } }, | |
| 24 | .{ .name = "BENGALI SEQUENCE FOR LETTER YYA", .sequence = &[_]u21{ 0x09AF, 0x09BC, } }, | |
| 25 | .{ .name = "GURMUKHI SEQUENCE FOR LETTER LLA", .sequence = &[_]u21{ 0x0A32, 0x0A3C, } }, | |
| 26 | .{ .name = "GURMUKHI SEQUENCE FOR LETTER SHA", .sequence = &[_]u21{ 0x0A38, 0x0A3C, } }, | |
| 27 | .{ .name = "GURMUKHI SEQUENCE FOR LETTER KHHA", .sequence = &[_]u21{ 0x0A16, 0x0A3C, } }, | |
| 28 | .{ .name = "GURMUKHI SEQUENCE FOR LETTER GHHA", .sequence = &[_]u21{ 0x0A17, 0x0A3C, } }, | |
| 29 | .{ .name = "GURMUKHI SEQUENCE FOR LETTER ZA", .sequence = &[_]u21{ 0x0A1C, 0x0A3C, } }, | |
| 30 | .{ .name = "GURMUKHI SEQUENCE FOR LETTER FA", .sequence = &[_]u21{ 0x0A2B, 0x0A3C, } }, | |
| 31 | .{ .name = "ORIYA SEQUENCE FOR LETTER RRA", .sequence = &[_]u21{ 0x0B21, 0x0B3C, } }, | |
| 32 | .{ .name = "ORIYA SEQUENCE FOR LETTER RHA", .sequence = &[_]u21{ 0x0B22, 0x0B3C, } }, | |
| 33 | }; |