authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-06-07 05:33:00 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-06-07 05:33:00 -07:00
log2076b1bd3dfc651cbe4bad90aac9e8a59454ad0a
treea04fe47665f632634820b78bdf21e9354d2499ca
parent18194d7547479fe30461248675246be8155bb433

util/yaml- add a Sequence type


1 files changed, 4 insertions(+), 2 deletions(-)

src/util/yaml.zig+4-2
...@@ -18,7 +18,7 @@ pub const Item = union(enum) {...@@ -18,7 +18,7 @@ pub const Item = union(enum) {
18 event: c.yaml_event_t,18 event: c.yaml_event_t,
19 kv: Key,19 kv: Key,
20 mapping: Mapping,20 mapping: Mapping,
21 sequence: []const Item,21 sequence: Sequence,
22 document: Document,22 document: Document,
23 string: []const u8,23 string: []const u8,
2424
...@@ -46,6 +46,8 @@ pub const Item = union(enum) {...@@ -46,6 +46,8 @@ pub const Item = union(enum) {
46 }46 }
47};47};
4848
49pub const Sequence = []const Item;
50
49pub const Key = struct {51pub const Key = struct {
50 key: []const u8,52 key: []const u8,
51 value: Value,53 value: Value,
...@@ -54,7 +56,7 @@ pub const Key = struct {...@@ -54,7 +56,7 @@ pub const Key = struct {
54pub const Value = union(enum) {56pub const Value = union(enum) {
55 string: []const u8,57 string: []const u8,
56 mapping: Mapping,58 mapping: Mapping,
57 sequence: []const Item,59 sequence: Sequence,
5860
59 pub fn format(self: Value, comptime fmt: []const u8, options: std.fmt.FormatOptions, writer: anytype) @TypeOf(writer).Error!void {61 pub fn format(self: Value, comptime fmt: []const u8, options: std.fmt.FormatOptions, writer: anytype) @TypeOf(writer).Error!void {
60 try writer.writeAll("Value{");62 try writer.writeAll("Value{");