mirror of
https://github.com/ziglang/zig.git
synced 2025-12-31 02:23:22 +00:00
tapi: apply ast fixes
This commit is contained in:
parent
b55a3cefa4
commit
cea8a2f500
@ -82,6 +82,8 @@ pub const Node = struct {
|
||||
options: std.fmt.FormatOptions,
|
||||
writer: anytype,
|
||||
) !void {
|
||||
_ = fmt;
|
||||
_ = options;
|
||||
if (self.directive) |id| {
|
||||
try std.fmt.format(writer, "{{ ", .{});
|
||||
const directive = self.base.tree.tokens[id];
|
||||
@ -125,6 +127,8 @@ pub const Node = struct {
|
||||
options: std.fmt.FormatOptions,
|
||||
writer: anytype,
|
||||
) !void {
|
||||
_ = fmt;
|
||||
_ = options;
|
||||
try std.fmt.format(writer, "{{ ", .{});
|
||||
for (self.values.items) |entry| {
|
||||
const key = self.base.tree.tokens[entry.key];
|
||||
@ -159,6 +163,8 @@ pub const Node = struct {
|
||||
options: std.fmt.FormatOptions,
|
||||
writer: anytype,
|
||||
) !void {
|
||||
_ = fmt;
|
||||
_ = options;
|
||||
try std.fmt.format(writer, "[ ", .{});
|
||||
for (self.values.items) |node| {
|
||||
try std.fmt.format(writer, "{}, ", .{node});
|
||||
@ -174,7 +180,10 @@ pub const Node = struct {
|
||||
|
||||
pub const base_tag: Node.Tag = .value;
|
||||
|
||||
pub fn deinit(self: *Value, allocator: *Allocator) void {}
|
||||
pub fn deinit(self: *Value, allocator: *Allocator) void {
|
||||
_ = self;
|
||||
_ = allocator;
|
||||
}
|
||||
|
||||
pub fn format(
|
||||
self: *const Value,
|
||||
@ -182,6 +191,8 @@ pub const Node = struct {
|
||||
options: std.fmt.FormatOptions,
|
||||
writer: anytype,
|
||||
) !void {
|
||||
_ = fmt;
|
||||
_ = options;
|
||||
const start = self.base.tree.tokens[self.start.?];
|
||||
const end = self.base.tree.tokens[self.end.?];
|
||||
return std.fmt.format(writer, "{s}", .{
|
||||
@ -563,7 +574,6 @@ const Parser = struct {
|
||||
if (self.eatToken(.SingleQuote)) |_| {
|
||||
node.start = node.start.? + 1;
|
||||
while (true) {
|
||||
const pos = self.token_it.pos;
|
||||
const tok = self.token_it.next();
|
||||
switch (tok.id) {
|
||||
.SingleQuote => {
|
||||
@ -579,7 +589,6 @@ const Parser = struct {
|
||||
if (self.eatToken(.DoubleQuote)) |_| {
|
||||
node.start = node.start.? + 1;
|
||||
while (true) {
|
||||
const pos = self.token_it.pos;
|
||||
const tok = self.token_it.next();
|
||||
switch (tok.id) {
|
||||
.DoubleQuote => {
|
||||
@ -594,7 +603,6 @@ const Parser = struct {
|
||||
|
||||
// TODO handle multiline strings in new block scope
|
||||
while (true) {
|
||||
const pos = self.token_it.pos;
|
||||
const tok = self.token_it.next();
|
||||
switch (tok.id) {
|
||||
.Literal => {},
|
||||
|
||||
@ -175,7 +175,6 @@ pub const Value = union(ValueType) {
|
||||
|
||||
if (list.values.items.len > 0) {
|
||||
const hint = if (list.values.items[0].cast(Node.Value)) |value| hint: {
|
||||
const elem = list.values.items[0];
|
||||
const start = tree.tokens[value.start.?];
|
||||
const end = tree.tokens[value.end.?];
|
||||
const raw = tree.source[start.start..end.end];
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user