authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2021-06-24 14:52:12+02:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2021-06-24 15:01:14+02:00
logcea8a2f5008bdda8bfd85af58537d148edde75ba
treeb37a5a6f78901337e6683378ad6becf5dffae6f7
parentb55a3cefa49549e62dbd40f385cc0a5b4b6433b3

tapi: apply ast fixes


2 files changed, 12 insertions(+), 5 deletions(-)

src/link/tapi/parse.zig+12-4
......@@ -82,6 +82,8 @@ pub const Node = struct {
8282 options: std.fmt.FormatOptions,
8383 writer: anytype,
8484 ) !void {
85 _ = fmt;
86 _ = options;
8587 if (self.directive) |id| {
8688 try std.fmt.format(writer, "{{ ", .{});
8789 const directive = self.base.tree.tokens[id];
......@@ -125,6 +127,8 @@ pub const Node = struct {
125127 options: std.fmt.FormatOptions,
126128 writer: anytype,
127129 ) !void {
130 _ = fmt;
131 _ = options;
128132 try std.fmt.format(writer, "{{ ", .{});
129133 for (self.values.items) |entry| {
130134 const key = self.base.tree.tokens[entry.key];
......@@ -159,6 +163,8 @@ pub const Node = struct {
159163 options: std.fmt.FormatOptions,
160164 writer: anytype,
161165 ) !void {
166 _ = fmt;
167 _ = options;
162168 try std.fmt.format(writer, "[ ", .{});
163169 for (self.values.items) |node| {
164170 try std.fmt.format(writer, "{}, ", .{node});
......@@ -174,7 +180,10 @@ pub const Node = struct {
174180
175181 pub const base_tag: Node.Tag = .value;
176182
177 pub fn deinit(self: *Value, allocator: *Allocator) void {}
183 pub fn deinit(self: *Value, allocator: *Allocator) void {
184 _ = self;
185 _ = allocator;
186 }
178187
179188 pub fn format(
180189 self: *const Value,
......@@ -182,6 +191,8 @@ pub const Node = struct {
182191 options: std.fmt.FormatOptions,
183192 writer: anytype,
184193 ) !void {
194 _ = fmt;
195 _ = options;
185196 const start = self.base.tree.tokens[self.start.?];
186197 const end = self.base.tree.tokens[self.end.?];
187198 return std.fmt.format(writer, "{s}", .{
......@@ -563,7 +574,6 @@ const Parser = struct {
563574 if (self.eatToken(.SingleQuote)) |_| {
564575 node.start = node.start.? + 1;
565576 while (true) {
566 const pos = self.token_it.pos;
567577 const tok = self.token_it.next();
568578 switch (tok.id) {
569579 .SingleQuote => {
......@@ -579,7 +589,6 @@ const Parser = struct {
579589 if (self.eatToken(.DoubleQuote)) |_| {
580590 node.start = node.start.? + 1;
581591 while (true) {
582 const pos = self.token_it.pos;
583592 const tok = self.token_it.next();
584593 switch (tok.id) {
585594 .DoubleQuote => {
......@@ -594,7 +603,6 @@ const Parser = struct {
594603
595604 // TODO handle multiline strings in new block scope
596605 while (true) {
597 const pos = self.token_it.pos;
598606 const tok = self.token_it.next();
599607 switch (tok.id) {
600608 .Literal => {},
src/link/tapi/yaml.zig-1
......@@ -175,7 +175,6 @@ pub const Value = union(ValueType) {
175175
176176 if (list.values.items.len > 0) {
177177 const hint = if (list.values.items[0].cast(Node.Value)) |value| hint: {
178 const elem = list.values.items[0];
179178 const start = tree.tokens[value.start.?];
180179 const end = tree.tokens[value.end.?];
181180 const raw = tree.source[start.start..end.end];